use-revolution Digest, Vol 28, Issue 45

Mark Greenberg markgreenberg at cox.net
Fri Jan 20 20:02:57 EST 2006


Christian, there is an easy RegEx way to do it:

Put ReplaceText (OrigText,"[,.;:!?]","") into NoPunct

Whatever you consider punctuation goes inside the [].  Quotation  
marks are tricky, as are dashes and carets.  To include quotation  
marks, use...

Put ReplaceText (OrigText,"[,.;:!?" & Quote & "]","") into NoPunct

If a caret is the first character inside the [], then it negates the  
list.  This means delete everything except the punctuation:

Put ReplaceText (OrigText,"[^,.;:!?]","") into NoPunct

But this means delete the punctuation, including carets:

Put ReplaceText (OrigText,"[,.;:^!?]","") into NoPunct

If you consider a dash as one of the punctuation marks that you'd  
like to remove, then it should be the first character inside the []:

Put ReplaceText (OrigText,"[-,.;:!?]","") into NoPunct

By the way, if you are writing a stack where the computer removes  
punctuation that a student then has to type back in correctly, I've  
written two such stacks.  Maybe I could help.

On Jan 19, 2006, at 6:23 PM, Christian Langers wrote:

> Does anybody know how to remove any ponctuation from text ?
>
> any regex filtering ?




More information about the use-livecode mailing list