From: Lew on
"gwoodho...(a)gmail.com" writes:
>> I'm trying to remove this from a String: "<![CDATA["
>>
>> But when using this line it ignores it (Would usually just single
>> escape it but java doesn't like that either):
>> tagContents.replaceAll("<!\\[CDATA\\[", "");
>>
>> When using this one it throws an execption (With good cause since [ is
>> a regex special character):
>> tagContents.replaceAll("<![CDATA[", "");
>>
>> Whats your guys suggestion?
>

Jim Janney wrote:
> tagContents.replaceAll(Pattern.quote("<![CDATA["), "");
>

This has the exact same effect as the OP's code.

It's a useful idiom to know.

--
Lew
From: Daniel Pitts on
On 5/4/2010 9:10 AM, Lew wrote:
> "gwoodho...(a)gmail.com" writes:
>>> I'm trying to remove this from a String: "<![CDATA["
>>>
>>> But when using this line it ignores it (Would usually just single
>>> escape it but java doesn't like that either):
>>> tagContents.replaceAll("<!\\[CDATA\\[", "");
>>>
>>> When using this one it throws an execption (With good cause since [ is
>>> a regex special character):
>>> tagContents.replaceAll("<![CDATA[", "");
>>>
>>> Whats your guys suggestion?
>>
>
> Jim Janney wrote:
>> tagContents.replaceAll(Pattern.quote("<![CDATA["), "");
>>
>
> This has the exact same effect as the OP's code.
>
> It's a useful idiom to know.

You're statements are both true.

So are both of mine. :-)

--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
From: Daniel Pitts on
On 5/4/2010 12:11 PM, Daniel Pitts wrote:
> On 5/4/2010 9:10 AM, Lew wrote:
>> This has the exact same effect as the OP's code.
>>
>> It's a useful idiom to know.
>
> You're statements are both true.
>
> So are both of mine. :-)
>

Although, not both of my statements were spelled correctly.
"You're"->"Your" ;-)



--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
From: Eric Sosman on
On 5/4/2010 4:07 PM, Daniel Pitts wrote:
> On 5/4/2010 12:11 PM, Daniel Pitts wrote:
>> On 5/4/2010 9:10 AM, Lew wrote:
>>> This has the exact same effect as the OP's code.
>>>
>>> It's a useful idiom to know.
>>
>> You're statements are both true.
>>
>> So are both of mine. :-)
>>
>
> Although, not both of my statements were spelled correctly.
> "You're"->"Your" ;-)

If youd kept quiet about it, Idve thought it was in homage
to the O.P.s missing apostrophes in "Whats your guys suggestion?"
Arent you sorry you self-respond'ed?

--
Eric Sosman
esosman(a)ieee-dot-org.invalid
From: Daniel Pitts on
On 5/4/2010 1:49 PM, Eric Sosman wrote:
> On 5/4/2010 4:07 PM, Daniel Pitts wrote:
>> On 5/4/2010 12:11 PM, Daniel Pitts wrote:
>>> On 5/4/2010 9:10 AM, Lew wrote:
>>>> This has the exact same effect as the OP's code.
>>>>
>>>> It's a useful idiom to know.
>>>
>>> You're statements are both true.
>>>
>>> So are both of mine. :-)
>>>
>>
>> Although, not both of my statements were spelled correctly.
>> "You're"->"Your" ;-)
>
> If youd kept quiet about it, Idve thought it was in homage
> to the O.P.s missing apostrophes in "Whats your guys suggestion?"
> Arent you sorry you self-respond'ed?
>
N'pe N't at all.

--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>