Selecting text using REGEX

Ken Ray kray at sonsothunder.com
Wed Oct 1 00:25:01 EDT 2003


> > function Trim what
> >   local tText
> >   get matchText(what,"(?s)\s*(\S.*\S)\s*",tText)
> >   return tText
> > end Trim
> 
> Thanks Ken this is a good one.
> 
> People might be confused about the (?s) since it's not in the 
> transcript docs- but it is in the PCRE docs. (?s) says the dot 
> metacharacter  matches any character, including newlines. 

Yup, this is one of those gems that make PCRE so very useful... :-)

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/ 





More information about the use-livecode mailing list