![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | 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. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| regex question | xiamin | Shell Programming and Scripting | 3 | 03-05-2009 02:53 AM |
| Quick regex question | retrovertigo | Shell Programming and Scripting | 1 | 07-06-2007 05:49 PM |
| regex question | arushunter | Shell Programming and Scripting | 8 | 01-04-2007 05:49 PM |
| Newbie Regex Question | ciremg01 | UNIX for Dummies Questions & Answers | 0 | 11-30-2005 05:30 PM |
| regex question | rocketkids | UNIX for Dummies Questions & Answers | 6 | 02-12-2004 05:49 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
regex question about greediness
Hello guys,
I am learning greediness part of regular express, and read example as this, To match text wrapped in double quotes in sentence <The name "McDonald's" is said "makudonarudo" in Japanese> You need use "[^"]*" to avoid greediness, as following $ sed 's/"[^"]*"/ /g' wk The name is said in Japanese I am a little confused on this, as I know, * means match ZERO or more preceding. so basically although [^"] mean any character except ", with a * it should turn to match ANY character(s), which will unfortunately include " again, but why the regex works? ![]() |
|
||||
|
Quote:
Hmmm, I think I did not express my question clearly, let me clarify. let's forget about greediness first, my question is about the regular express [^"]* In the example above, [^"]* are used to match any characters except ", right? But, I think it is wrong, * means match ZERO or more preceding So I think [^"]* does no make sense, it can match " ![]() |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|