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.
Another Table Regex Question
Moderator: General Moderators
- prometheuzz
- Forum Regular
- Posts: 779
- Joined: Fri Apr 04, 2008 5:51 am
Re: Another Table Regex Question
Have you tried some things yourself already? If so, could you post it here and explain how/when they failed?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.
Re: Another Table Regex Question
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.
I tried searching your forums for solutions, but the search function doesn't seem to work properly.
- prometheuzz
- Forum Regular
- Posts: 779
- Joined: Fri Apr 04, 2008 5:51 am
Re: Another Table Regex Question
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.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.
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
OK, I'll check out that website. Thanks for the tip about lookahead.
- prometheuzz
- Forum Regular
- Posts: 779
- Joined: Fri Apr 04, 2008 5:51 am
Re: Another Table Regex Question
You're welcome.GeoBear wrote:OK, I'll check out that website. Thanks for the tip about lookahead.