Index

Subject : Re: LUG: Regex help

From : Edward Anderson <nilbus@gmail.[redacted]>

Date : Sun, 27 Jun 2010 08:29:09 -0400

Parent


The problem you're having is that bash is interpreting your \, and
it's not getting passed into egrep. Enclosing it in quotes should do
the trick.

"^[0-9]{2}\."

On Jun 27, 2010, at 2:24 AM, "Daniel Underwood" <daniel.underwood@ncsu.[redacted]
> wrote:

> I have lines of text such as the following:
>
> 23,45,45,
> 24.45.65
>
> I want to match "periods" not the "commas". I know that I can simply
> [^\,] take the compliment of the commas for the above text, but assume
> that's not sufficient. How can I match a period and only a period.
> When I use
>
> ^[0-9]{2}\.
>
> it matches both of the above lines. It matches 23, and 24..
>
> (FYI: I'm using regexp in the context of egrep)
> --
> Daniel Underwood
> North Carolina State University
> Graduate Student - Operations Research
> email: daniel.underwood@ncsu.[redacted]
> phone: XXX.302.3291
> fax: XXX.515.5281
> web: http://www4.ncsu.edu/~djunderw/
>