![]() |
#1 |
Dylanologist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 200
Karma: 146754
Join Date: Apr 2010
Location: Hanover, New Hampshire, USA
Device: none/all/any
|
Grep Find & Replace
I am a novice Grep user.
Can someone help me with the Grep expression to FIND all text within parentheses, including the parentheses themselves, and the blank space before and after? BRFORE: Yada yada (text text) yada yada. AFTER: Yada yada yada yada. Thanks - Fabe |
![]() |
![]() |
![]() |
#2 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 657
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
|
Fabe, would it be something like
Search for Code:
\s\(.+?\)\s Edit: \s = whitespace \( = open parenthesis .+? = any text possibly none \) = close parenthesis \s = whitespace Last edited by Perkin; 12-06-2010 at 06:04 AM. Reason: Extra information |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Dylanologist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 200
Karma: 146754
Join Date: Apr 2010
Location: Hanover, New Hampshire, USA
Device: none/all/any
|
Perkin - Thank you, that worked perfectly. I learned several things, much obliged.
########## ADDENDUM: There is a flaw. If there are two parenthetical entries in a paragraph, this FIND & REPLACE eliminates the text between them along with what's inside. EXAMPLE: What to do? - Fabe
Now is the time for all good men (and women for that matter) to come to the aid of (or at least make a donation to) their country. RETURNS: Now is the time for all good men their country. Last edited by Fabe; 12-06-2010 at 09:18 AM. Reason: Flaw Found |
![]() |
![]() |
![]() |
#4 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 657
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
|
I think that depends on which version/adaptation you're using.
Also if the version your using has a switch to allow 'minimal matching' (or lazy) (much like the Sigil S&R dialog) that should then capture correctly. That's what the '?' should be doing anyway. You could also try changing the '+' to '*' |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help with Word - Find & Replace | Big Kev | Workshop | 3 | 09-21-2010 06:51 PM |
REGEX find and replace help please | potestus | Sigil | 13 | 09-18-2010 04:14 PM |
find and replace, epub | ampsonic | Reading and Management | 3 | 03-02-2010 03:20 AM |
Crashes on find / replace all | mr ploppy | Sigil | 1 | 02-03-2010 12:35 PM |
Using Find/Replace with BD | Otter | Sony Reader | 7 | 02-28-2009 01:49 PM |