regex question
Jim Ault
JimAultWins at yahoo.com
Sun May 18 12:37:32 EDT 2008
On 5/18/08 9:24 AM, "jbv" <jbv.silences at club-internet.fr> wrote:
> Does anyone have a regex to remove any text between parenthesis
> (including the
> parenthesis) ?
>
> I've tried many options, but none seems to work perfectly...
>
> For instance :
> "\(\)" removes only parenthesis with no text inside
>
> I've also tried this : "\([a-z 0-9 ]+\)", but no luck...
Try this:
make a new stack
add field "input" and field "output"
then this handler in the stack script
---------start copy
on mouseDoubleUp
get fld "input"
put "(?U)\(.*\)" into regEx
put replaceText(it, regEx, "") into ans
repeat for each word WRD in ans
put WRD & space after smoothAns
end repeat
put smoothAns into fld "output"
end mouseDoubleUp
-----end copy
the regEx says "open paren, then any character, repeating until a close
paren is found.
the (?U) says to find the shortest match rather than the longest possible
match. RegEx defaults to finding the longest possible match.
Hope this helps.
Jim Ault
Las Vegas
More information about the use-livecode
mailing list