Re: Regex -- Replace "-*?\n" with ""
- From: "Bruce Barker" <brubar_nospamplease_@xxxxxxxxxx>
- Date: Fri, 22 Jul 2005 17:27:10 -0700
actually http 1.1 switched to "\r\n", so the apache server should serve the
html the samer way.
-- bruce (sqlwork.com)
"Brent" <""b b i g l e r \"@ y a h o o . c o m"> wrote in message
news:11e2v8289rtn933@xxxxxxxxxxxxxxxxxxxxx
> Thanks Tom!
>
> I hacked around some more with this stuff, and it turns out that
> ".*?--+\n" works. Some of the "----" strings were preceded by spaces, so
> this seems to be a better, uh, match.
>
> And, yes, your reply does help.
>
> Oh...the text is being sucked in over HTTP directly from an Apache server,
> so the \n seems to be appropriate.
>
> Tricky things, these regexes!
>
> --Brent
>
>
> Tom.PesterDELETETHISSS@xxxxxxxxxx wrote:
>> Hi Brent,
>>
>> Starting a newline is \r\n on dos/windows systems.
>>
>> So if you use
>> "-*?\r\n"
>> on
>> "----------------------------------------
>> "
>> "----------------------------------------
>> "
>>
>> It will match 2 times.
>>
>> A caution is maybe in order here. If you use a lazy non greedy quantifier
>> it will match the shortest string possible.
>>
>> So if you let the regex -*?
>> Loose on 5 times a dash
>> -----
>> The result will be 6 *empty* matches : m-m-m-m-m-m
>>
>> Whe empty? bacause the star in your regex allows 0 occurences. So the
>> shortest string possible is the empty string.
>>
>> Compare this with the regex
>> -*?a
>> on
>> -----a
>>
>> Now you want an a to be at the end of a match so the shortest string
>> possible is now : -----a
>> This is the whole original input string and this is the only match.
>>
>> You say you want a windows newline so your doing fine.
>>
>>
>> Let me know if you have any more questions..
>>
>> Cheers,
>> Tom Pester
.
- References:
- Regex -- Replace "-*?\n" with ""
- From: Brent
- Re: Regex -- Replace "-*?\n" with ""
- From: Tom . PesterDELETETHISSS
- Re: Regex -- Replace "-*?\n" with ""
- From: Brent
- Regex -- Replace "-*?\n" with ""
- Prev by Date: Re: form closing
- Next by Date: Re: More than one parameter in DataTextFormatString?
- Previous by thread: Re: Regex -- Replace "-*?\n" with ""
- Next by thread: Re: Regex -- Replace "-*?\n" with ""
- Index(es):