> > > 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
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
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,
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
[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 "
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
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
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++;
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]
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/
[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
11 matches
Mail list logo