Thoughts regular expressions in, for example sed
JD
jd1008 at gmail.com
Sat Jan 12 00:20:10 UTC 2013
On Fri, Jan 11, 2013 at 3:43 PM, Johnny Rosenberg <gurus.knugum at gmail.com>wrote:
> I don't know if regular expressions are used the same way in all those
> nice tools, like sed, grep and whatever, but I can't stop wondering
> why the regular expression syntax is so inconsistent.
>
> Some characters are used for things, so if I want to search for them I
> need to escape them, for example ”.\[]{}”, but what about ()? They are
> the other way around: I have to escape them when I want to use them!
> Why is this?
>
>
My $.02's worth is:
Each app has it's own language.
The shell has it's own lang and reserved symbols (characters)
which must be escaped or quoted within single quote marks
if they are to be passed to an application,
and sed has it's own language and reserved set of symbols, ....etc.
This is why RE's for each app have differences.
However, there are plenty of commonalities.
For example sed and vi and others, . (dot) will match any char
when modifying or searching for patterns.
Cheers,
JD
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20130111/75a95e47/attachment.html>
More information about the ubuntu-users
mailing list