Page 1 of 1
Another Table Regex Question
Posted: Wed May 13, 2009 9:54 pm
by GeoBear
Can anyone tell me what kind of regex script I could use to?...
1. Delete every table row that includes the word billion in at least one table cell
2. Delete every row that does NOT include the word billion in at least one table cell
Thanks.
Re: Another Table Regex Question
Posted: Thu May 14, 2009 3:42 am
by prometheuzz
GeoBear wrote:Can anyone tell me what kind of regex script I could use to?...
1. Delete every table row that includes the word billion in at least one table cell
2. Delete every row that does NOT include the word billion in at least one table cell
Thanks.
Have you tried some things yourself already? If so, could you post it here and explain how/when they failed?
Re: Another Table Regex Question
Posted: Thu May 14, 2009 8:22 am
by GeoBear
I wouldn't even have a clue where to begin. I'm new to regex. I downloaded a software program called RegExhibit and figured out a really simple script that deletes everything between two elements. But deleting table rows that contain particular words is way over my head.
I tried searching your forums for solutions, but the search function doesn't seem to work properly.
Re: Another Table Regex Question
Posted: Fri May 15, 2009 3:29 am
by prometheuzz
GeoBear wrote:I wouldn't even have a clue where to begin. I'm new to regex. I downloaded a software program called RegExhibit and figured out a really simple script that deletes everything between two elements. But deleting table rows that contain particular words is way over my head.
I tried searching your forums for solutions, but the search function doesn't seem to work properly.
The first thing is to describe exactly (on paper preferably) how you would do it by "hand". So how does a table row with the a certain value in it differ from a table row that does not have such a value. You might say: "well, one does and one doesn't", but that is not something regex "understands". You'll have to describe it very precisely.
One hint I'll give you is that you need positive look ahead for this. But to be honest, if you're really new to regex, I highly recommend doing some tutorials before plunging in it and trying to do these more advanced things: IMO, that is not the proper way to learn regex (or any other new thing).
By far the best online resource for regex is this site:
http://www.regular-expressions.info/ (there's also a "look-around" tutorial)
When you have tried something but get stuck, I'm more than happy to give you a hand, but I'd like you to try first.
Good luck.
Re: Another Table Regex Question
Posted: Fri May 15, 2009 9:44 am
by GeoBear
OK, I'll check out that website. Thanks for the tip about lookahead.
Re: Another Table Regex Question
Posted: Fri May 15, 2009 10:59 am
by prometheuzz
GeoBear wrote:OK, I'll check out that website. Thanks for the tip about lookahead.
You're welcome.