[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
regex confusion -- not matching; think it should?
From: |
Linda Walsh |
Subject: |
regex confusion -- not matching; think it should? |
Date: |
Wed, 12 Jun 2013 15:53:50 -0700 |
User-agent: |
Thunderbird |
The trace looks aprolike this:
./ifc#137(handle_bonding_ops)> (( 18>3 ))
./ifc#138(handle_bonding_ops)> [[ mode=balance-rr 0 =~
^([a-zA-Z][-a-zA-Z0-9_]+)=(.+)[[:space:]]+[a-zA-Z][-a-zA-Z0-9_]+=.+.*$ ]]
./ifc#142(handle_bonding_ops)> [[ mode=balance-rr 0 =~
^([a-zA-Z][-a-zA-Z0-9_]+)=(.+)$ ]]
./ifc#145(handle_bonding_ops)> break
(#138 is all 1 line)
---- the source code looks like this:
my id='[a-zA-Z][-a-zA-Z0-9_]+'
while ((${#bond_ops}>3)); do
if [[ $bond_ops =~ ^($id)=(.+)[[:space:]]+$id=.+.*$ ]]; then
...
elif [[ "$bond_ops" =~ ^($id)=(.+)$ ]]; then
...
else break; fi
---
I would think the 2nd match would match it, but no luck...
Note the 2nd source line has double quotes due to testing...
Originally it had no quotes, as I don't believe they are
necessary in this case. Regardless, neither way matches.
So if not obvious, bond_ops has "mode=balance-rr 0" in it.
Thanks...