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

C

Covington Bradshaw

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
 
C

Chris Smith

Covington Bradshaw said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,130
Latest member
MitchellTe
Top