Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > A? question? about? regular? expressions?, Take? 2?

Reply
Thread Tools

A? question? about? regular? expressions?, Take? 2?

 
 
Covington Bradshaw
Guest
Posts: n/a
 
      12-17-2006
Hi every one,

I have a basic regular expressions question.
It goes like this: How do I extract a sequence of
@-delimited characters from a text?

Example: @{1}.*?@{1}
Will give:
123456789abcdefhghij
When applied to the following text:
@123456789abcdefghij@987654321stuvwxyz@

However I am trying to build a regular expression
for the more complex case that will also handle the
escape character for @ which the double @@. Consequently
I need to know how to extract

123456789@@abcdefhghij

from

@123456789@@abcdefghij@987654321@@stuvwxyz@

using regular expressions.

Thanks
 
Reply With Quote
 
 
 
 
Chris Smith
Guest
Posts: n/a
 
      12-17-2006
Covington Bradshaw <(E-Mail Removed)> wrote:
> However I am trying to build a regular expression
> for the more complex case that will also handle the
> escape character for @ which the double @@.


Ah, I think I see what you mean. How about:

@([^@]|((@@)*))@

The result will be in group 1.

It would be nice if you'd provided this information in your existing
thread rather than starting a new one.

--
Chris Smith
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments