Pattern matching

Thalassicus

Bytes and Nibblers
Joined
Nov 9, 2005
Messages
11,057
Location
Texas
How do I use tagged regular expressions to match an indeterminate repetition of a substring? Like for example... I'm trying to do this:

strHelpText = string.gsub(strHelpText, "^(%[NEWLINE%])+", "")

I would expect it to match one or more [NEWLINE] at the start of a string, but it doesn't, which is confusing.
 
I think the parentheses need to be around the whole pattern, so "(^%[NEWLINE%]+)". Not sure though, I've never really used regular expressions much
 
Back
Top Bottom