RE: quick re help

2003-08-15 Thread Robert J Taylor
> > > what is less awkward than [\s|\S] for 'match anything?' > > > >. > > > >Yes ->.<- > > > >Dot, period, point, et al, is the universal match "something" symbol. So, > >m'.*$' matches everthing on a line. If you want to match a period you can > >either escape it: \. or bracket it [.]. E

Re: quick re help

2003-08-14 Thread Jeff 'japhy' Pinyan
On Aug 13, [EMAIL PROTECTED] said: >It messes up when I need to wrap lines with \n that don't end in a space. >If there is no space, it places last word on its own line before it >should wrap. Otherwise it double \ns the line. >sub quickWrap { > my $data = @_[0]; You shouldn't use an arra

RE: quick re help

2003-08-14 Thread Perry, Alan
Robert J Taylor wrote: > >[EMAIL PROTECTED] inquired: > > >> This regex looks familiar. I'm going to suggest a big change in a > >> bit. > >> Oh, and [\s|\S], which could be [\s\S], is kind of awkward. > > > what is less awkward than [\s|\S] for 'match anything?' > >. > >Yes ->.<- > >Dot, period,

quick re help

2003-08-14 Thread [EMAIL PROTECTED]
Hi everyone I am pretty new to regex's, so I was happy when my text wrapping expression worked - for the most part. It messes up when I need to wrap lines with \n that don't end in a space. If there is no space, it places last word on its own line before it should wrap. Otherwise it double \ns

RE: quick re help

2003-08-14 Thread Robert J Taylor
[EMAIL PROTECTED] inquired: >> This regex looks familiar. I'm going to suggest a big change in a >> bit. >> Oh, and [\s|\S], which could be [\s\S], is kind of awkward. > what is less awkward than [\s|\S] for 'match anything?' . Yes ->.<- Dot, period, point, et al, is the universal match "

Re: quick re help

2003-08-14 Thread Jeff 'japhy' Pinyan
On Aug 13, [EMAIL PROTECTED] said: >Jeff 'Japhy' Pinyan wrote: >> On Aug 13, [EMAIL PROTECTED] said: >> >> my $data = shift; >> my $wrap_at = @_ ? shift : 75; >> > >I like that. The simpler-looking my $wrap_at = shift || 75; has also been proposed. The only reason I didn't use that is be

RE: quick re help

2003-08-14 Thread Perry, Alan
Jeff 'japhy' Pinyan wrote: > >On Aug 14, Perry, Alan said: > >>So, /[\s\S]/ would match a "\n", while /./ would not. The equivalent of >>/[\s\S]/, using period notation, would be /[.\n]/ > >Not so much; the . in a character class matches just itself. You are correct, I forgot about that. You cou

Re: quick re help

2003-08-14 Thread [EMAIL PROTECTED]
Jeff 'Japhy' Pinyan wrote: On Aug 13, [EMAIL PROTECTED] said: sub quickWrap { my $data = @_[0]; You shouldn't use an array slice where you mean to use a single array element. Thanks for catching that, I should have really seen that one. $times_to_reread_my_code_before_posting_to_list++;

Re: quick re help

2003-08-14 Thread James Edward Gray II
On Wednesday, August 13, 2003, at 04:22 PM, [EMAIL PROTECTED] wrote: Jeff 'Japhy' Pinyan wrote: On Aug 13, [EMAIL PROTECTED] said: my $wrap_at = @_ ? shift : 75; I like that. Just to add my two cents, I like: my $wrap_at = shift || 75; James Gray -- To unsubscribe, e-mail: [EMAIL PROTECTED]

RE: quick re help

2003-08-14 Thread Jeff 'japhy' Pinyan
On Aug 14, Perry, Alan said: >So, /[\s\S]/ would match a "\n", while /./ would not. The equivalent of >/[\s\S]/, using period notation, would be /[.\n]/ Not so much; the . in a character class matches just itself. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/

Re: quick re help

2003-08-14 Thread Janek Schleicher
[EMAIL PROTECTED] wrote at Wed, 13 Aug 2003 15:22:59 -0600: >>>sub quickWrap { >>> my $data = @_[0]; >> >> >> You shouldn't use an array slice where you mean to use a single array >> element. >> > > Thanks for catching that, I should have really seen that one. No, Perl should have seen it