- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- egrep issue
Categories
Company
Local Language
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2004 09:53 AM
10-18-2004 09:53 AM
so i got the unfortunate task of
debugging a former employees code
and came across an unusual piece that
has me quite complexed (not used to this - im an GUI developer by trade but cutbacks leave us in new worlds).
can anyone here, enlighten me as to what this is trying to match?
^(a(cj)+)\1*$
any suggestions or thoughts?
spent all day discussing it with another developer and we cant figure what its trying to match.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2004 09:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2004 10:00 AM
10-18-2004 10:00 AM
Re: egrep issue
^ Matches start of line
() A grouping definition
+ Matches at least one or more of pattern
\1 Repeats on first () enclosed pattern
* Matches zero or more of pattern
$ Matches end of line
The smallest match would be-
acj
HTH
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2004 10:14 AM
10-18-2004 10:14 AM
Re: egrep issue
and repeated?
the number of cj's between a's can be
1 or greater?
the * doesnt encompass the entire expression? allowing for an empty string
and the \1 applies to the entire expression
a(cj) not just the a?
so since the entire expression
(a(cj)+) is followed by the \1
it is referring to the entire thing
not just the a
if it were \2 then it would refer only to
the (cj)+ part correct?
i think this means im winning a lunch
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2004 10:22 AM
10-18-2004 10:22 AM
Re: egrep issue
With out the \1 their, the pattern could match an empty line also.
HTH
-- Rod Hills