|
Search Forums:
|
|||||||
| Forums | Register | Forum Rules | Linux and Unix Links | Man Pages | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to do equivalent of /(regexp){0}/ ?
I don't want to have to resort to Code:
/([^s][^t][^r][^i][^n][^g])/ though that does work. Effectively, I need to be able to implement Code:
/(?:(?:regexp1){0}[^-0-9])(regexp2)\D/to basically match regexp2 as long as it is present and regexp1 is NOT. So, how to do Code:
/(regexp){0}/? |
| Sponsored Links | |
|
|
|
#2
|
||||
|
||||
|
You need a zero-width negative look-behind assertion from the extended patterns. Example: Code:
$ cat /tmp/test.txt This should be matched. This should not be matched. $ perl -ne 'print if /(?<!not\s)be/;' /tmp/test.txt This should be matched. $ |
| The Following User Says Thank You to pludi For This Useful Post: | ||
Vi-Curious (08-03-2011) | ||
| Sponsored Links | ||
|
|
|
#3
|
|||
|
|||
|
That's what I get for not reading the entire perlre doc.
![]() |
| Sponsored Links | ||
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Regexp tip | Dedalus | Shell Programming and Scripting | 3 | 09-23-2010 02:09 PM |
| sed regexp | King Nothing | Shell Programming and Scripting | 4 | 12-18-2009 06:34 AM |
| print the line immediately after a regexp; but regexp is a sentence | ownins | UNIX for Dummies Questions & Answers | 3 | 11-16-2008 01:30 AM |
| regexp help | TinCanFury | Shell Programming and Scripting | 0 | 04-06-2008 06:21 PM |
| regexp | penfold | UNIX for Advanced & Expert Users | 1 | 06-28-2005 07:45 AM |
|
|