Filter words from a list that begin with specific symbols

Dec 2, 2012 at 1:46am

Filter words from a list that begin with specific symbols

I’m not the best with reg expressions but I know what I’m trying to do is a pretty common task yet i’ve searched around without finding a solution so I’m reaching out to see if any of you could kindly help.

I’m trying to filter words from lists that begin with certain symbols.

For example if I had a list that was like “yes %no @maybe /so no”

and I wanted to remove the words that begin with the symbols % and @

my resulting list would be “yes /so no”

Does anybody know how to do this? I’m pretty sure that the right reg exp could take care of, but I’m having trouble figuring it out on my own. Thanks for whatever help you can offer.

#65460
Dec 2, 2012 at 9:13am

this seems to work, but there is probably a better way (not having to use the prepend object) (ie I’m no expert in regex stuff)

– Pasted Max Patch, click to expand. –
#235879
Dec 2, 2012 at 11:57am

Hi,

– Pasted Max Patch, click to expand. –
#235880
Dec 2, 2012 at 11:01pm

Terry & Nicolas, thank you much for the reply, these are really helping me to get closer to understanding the complex world of RegExpressions.

I’ve decided to go with Nicolas’s example :)

#235881

You must be logged in to reply to this topic.