Page 1 of 1

Removing quoted lines

Posted: Mon Oct 30, 2006 10:02 pm
by textlearner
Hi folks,

I would like to remove all text, but NOT numerical data which are in quotes.

e.g) "text_4"
becomes
_4

I'm sure its probably simple, but i dont know how to distinguish between the quotes themselves and the text within them. Obviously just putting " in the search removes the quotemarks and not the text within them.

tia

tl

Posted: Mon Oct 30, 2006 10:42 pm
by ben_josephs
Do you mean that you want to find text between double quotes, and that you want to delete those quote marks and everything between them that isn't a digit or an underscore? Is there at most one contiguous string of digits and underscores in such quoted text?

If so, this might do what you want:
Find what: "[^"0-9_]*([0-9_]+)[^"0-9_]*"
Replace with: \1

[X] Regular expression
This assumes you are using Posix regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax

Posted: Mon Oct 30, 2006 11:05 pm
by textlearner
Hi ben,

Thx for the feedback. This works, but some of my strings have more than one underscore in them, so i have decided it would be easier just to remove all text AND underscores between the double quotes, but im not sure how to alter your search string to do this.
Pls advise.

Posted: Tue Oct 31, 2006 7:43 am
by ben_josephs
Find what: "[^"0-9]*([0-9]+)[^"0-9]*"
Replace with: \1

[X] Regular expression