Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Originally posted by Tinkster Are you referring to programming with the RegEx libraries,
or using the Regular Expressions as they are being used
in tools as egrep, sed and awk?
If it's the latter, that tutorial is not for you, and you needn't
worry about bullet 3 and a bit of 2 on that page.
Cheers,
Tink
Actually I'm using it for a program called logsurfer. The documentation that comes with it refer to the webby for regex.
Ok, the [^ ] tells the expression to match against any character other than a space. The caret ( ^ ) at the beginning of the set, inverts how the set matches. So instead of matching what is listed, it matches anything that is not listed. The asterisk ( * ) specified to match 0 or more repeats of the previous set of characters. So, if there is a contiguous section of non-space characters, this pattern will match it. The parentheses are used to "store" the matched text. Usually, they are used in expressions to find the meaningful text in a line, and then replace the entire line leaving only the meaningful bits behind. Parentheses are also used to construct complex pattern matching by grouping combinations of small, primitive regular expressions.
EDIT:
Sorry, I got a little carried away. To directly answer your question, no, the expression you give will not allow a space before a given word is matched. In this case, it looks as though the parentheses are used in their "storage" role, and are not literal parentheses (you would need to escape them with a backslash to do that).
Last edited by Dark_Helmet; 09-04-2004 at 02:04 PM.
Unfortunately you have to realize that regular expressions are sometimes quite different from metacharactors.
Where as ^ generally means "at the beginning of the line"
when it is used in brackets it is as Dark_helmet said. It means the inverse (just like -v in grep).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.