Here's an abbreviated list of parenthetical lists. I tried and failed to use an RE to delete averything except those lists beginning with (10, resulting in (10 a b)(10 c d)(10 e f) etc. Any suggestions?
tcebob
code
(38 . 0.0) (39 . 0.0) (10 16.497 3.71905) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 16.308 3.62263) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 16.2112 3.47429) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 16.2823 3.32199) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 16.6007 3.20692) (40 . 0.0) (41 . 0.0) (42 . 0.0)
(10 17.6133 3.13585)
code
would become
code
(10 16.497 3.71905)(10 16.308 3.62263)(10 16.2112 3.47429)
(10 16.2823 3.32199)(10 16.6007 3.20692)(10 17.6133 3.13585)
code
Reducing a list
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
- Posts: 2459
- Joined: Sun Mar 02, 2003 9:22 pm
If the lists you want to delete are all those that don't begin with (10 followed by a space, then you can delete every list whose contents do not have a 1 in the first position, or do not have a 0 in the second position, or do not have a space in the third position:
This assumes you are using Posix regular expression syntax:Find what: -*\(([^1]..|.[^0].|..[^-])[^)]*\)-* [Replace the hyphens with spaces]
Replace with: [nothing]
[X] Regular expression
This sort of thing is much easier in WildEdit (http://www.textpad.com/products/wildedit/), in which you can use a negative lookahead assertion to cause a regular expression not to match at a position at which some subexpression does match:Configure | Preferences | Editor
[X] Use POSIX regular expression syntax
Look up lookahead in WildEdit's help.Find what: -*\((?!10-)[^)]*\)-*
Replace with: [nothing]
[X] Regular expression