When you are looking for 'CT', the regex is /CT/. when you are looking for the first number after 'CT', the regex becomes/CT .*? (\d*)/x. The x at the end of the regex allows me to insert spaces so that the regex is easier to read. They don't get matched. If you really need to match a space, you can put a slash before it or use \s which parses anything spacy, like tab characters too
When this regex matches something, it returns true. In that case what was parsed between the first and only parens is now in $1. Further parens in the regex would be stored in $2,$3,$4 and so on
The .*? matches anything, but tries to match as few characters as possible
With slight variations of this regex you probably can substitute all your index thingies.
You can even combine your regexes to one long regex by combining all of them with .*? inbetween.
In reply to Re^3: Parsing a Variable Format String
by jethro
in thread Parsing a Variable Format String
by ozboomer
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |