15 lines
312 B
Bash
15 lines
312 B
Bash
|
|
#!/bin/bash
|
||
|
|
|
||
|
|
# =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~
|
||
|
|
# Experimenting with backreferences in Bash regular expressions
|
||
|
|
# =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~
|
||
|
|
|
||
|
|
re='(\<.{1,10}\>) \1'
|
||
|
|
|
||
|
|
if [[ $1 =~ $re ]]; then
|
||
|
|
echo "Matched: $1"
|
||
|
|
else
|
||
|
|
echo "No match: $1"
|
||
|
|
fi
|
||
|
|
|