sunny-j
asked on
help with regular expressions
Need some help with matching a word using regular expressions. this below is not matching. Any help appreciated.
I am looking to match either
"Band:"
or
Band:
var pagesStr = content.GetElementsByTagNa me("SPAN") [18].Inner Html;
if (content != null && Regex.IsMatch(pagesStr, @"\^\[Band:\]\+\$"))
{
I am looking to match either
"Band:"
or
Band:
var pagesStr = content.GetElementsByTagNa
if (content != null && Regex.IsMatch(pagesStr, @"\^\[Band:\]\+\$"))
{
Though Fernando's pattern may work just fine, it will also match other values containing the characters in Band: such as BBBB or Bad:
I suggest making this modification if you need the exact string Band:
Note that will still match if there is just one double quote (or none, or one at each end). If that's a problem, let us know.
I suggest making this modification if you need the exact string Band:
Regex.IsMatch(pagesStr, @"\""?Band:\""?")
Note that will still match if there is just one double quote (or none, or one at each end). If that's a problem, let us know.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you both for your input and apologies for my delay in responding.
Open in new window