Subject: Re: Riddle me this: grep / regx experts
Allegedly, on or about 2 February 2018, R. G. Newbury sent:
I am cleaning up some html code, using sed to standardize the
formatting. I was searching for specific instances of code to amend
using grep.
In case you're not aware of it, there's
On Fri, 2018-02-02 at 12:32 -0500, R. G. Newbury wrote:
> > Thanks to all for the quick responses. I *tried* to RTFM but that was
>
> not clear, even on a re-read. I took [0-9]* as multiple instances of
> [0-9] but NOT zero instances..
From 'man grep':
Repetition
A regular expression
Allegedly, on or about 2 February 2018, R. G. Newbury sent:
> I am cleaning up some html code, using sed to standardize the
> formatting. I was searching for specific instances of code to amend
> using grep.
In case you're not aware of it, there's a HTML tidy command that
neatens up HTML.
dnf
On Fri, Feb 02, 2018 at 11:04:01AM -0500, R. G. Newbury wrote:
A bug in regx handling???
I am cleaning up some html code
.
# grep -h '[0-9]*s[0-9]*">' temp
>> Returns the example line with the 's[0-9]">' highlighted.
Can anyone explain what is happening?. This isn't politics so the
On Fri, Feb 02, 2018 at 11:04:01AM -0500, R. G. Newbury wrote:
> A bug in regx handling???
>
> I am cleaning up some html code, using sed to standardize the formatting. I
> was searching for specific instances of code to amend using grep.
> I was looking for instances like
> Example text in a
On Fri, 2018-02-02 at 11:04 -0500, R. G. Newbury wrote:
> # grep -h '[0-9]*s[0-9]*">' temp
> Returns the example line with the 's[0-9]">' highlighted.
In grep, * matches any number of instances, including 0. You want to
use + rather than * to guarantee at least one digit.
poc
Once upon a time, R. G. Newbury said:
> # grep -h '[0-9]*s[0-9]*">' temp
> Returns the example line with the 's[0-9]">' highlighted.
A * in a regex is "0 or more of the previous", so basically you are just
matching 's[0-9]*">' (because there will always be at least 0 of the