Can someone help me with a simple RegEx. I am looking to return each $Command(Parameter).
According to RegExBuddy I could just use \$\w+\(\w*\) but that's not valid PB RegEx syntax so I expanded (and simplified) the \w token.
According to RegExBuddy I could just use \$\w+\(\w*\) but that's not valid PB RegEx syntax so I expanded (and simplified) the \w token.
Code:
FUNCTION PBMAIN( ) LOCAL lngLen AS LONG LOCAL lngPos AS LONG LOCAL strRegEx AS STRING LOCAL strTestString AS STRING strRegEx = "\$[a-z]+\([a-z]*\)" strTestString = "/Switch1=$Command1(Parameter1) /Switch2=$Command2(Parameter2)" REGEXPR strRegEx IN strTestString TO lngPos, lngLen MSGBOX _ "Position = " & FORMAT$( lngPos ) & $CRLF & _ "Length = " & FORMAT$( lngLen ) & $CRLF & _ "Text = " & MID$( strTestString, lngPos, lngLen ) END FUNCTION
Comment