Here i find the most info if i try something new, or i ask in the forum here, how ever the site looks to be down for the moment, but you can try connect to it later on:
alias regextest {
var %text = this [is a long] string
var %re = /(\[.*?\])/
noop $regex(%text,%re)
echo -a $regml(1)
}
I'll try and break it down:
/(\[.*?\])/
These are just regex delimiters. You should always enclose your regex inside of these. When you capture a pattern inside of () brackets, you can reference it later with \1 or $regml(1) You match \[ rather than just [ because the [ and ] characters have special meaning in regular expressions, and \ acts as an escape character. . means any one character. * is a quantifier and means '0 or more', so when applied to ., .* join together and this expression becomes '0 or more cases of 1 character'. I wouldn't worry about the ? for now until you've got a basic grasp of simpler concepts.