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!
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.
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.
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.