469,362 Members | 2,548 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,362 developers. It's quick & easy.

Regular expressions question

Hi. You know that special character \b (word border) that is handy to use
because it does not eat a character that you might want to match to another
piece of your expression? \b matches the start or finish of a string of
word characters: letters, numbers, and _. Is there any way to match the
border of an arbitrary set of characters, also without eating a character?
For example, say I want to match to the beginning or end of a string of the
letters A, S, D, or F.

Thanks very much.

Joe Czapski
Boston, Mass.


Aug 17 '05 #1
1 3186
In article <y6********************@comcast.com>, Joseph Czapski
<jo**@nnnot.com> wrote:
Hi. You know that special character \b (word border) that is handy to use
because it does not eat a character that you might want to match to another
piece of your expression? \b matches the start or finish of a string of
word characters: letters, numbers, and _. Is there any way to match the
border of an arbitrary set of characters, also without eating a character?
For example, say I want to match to the beginning or end of a string of the
letters A, S, D, or F.


Your question doesn't make a lot of sense to me. The regex /[ASDF]+/
will match one or more of those characters in consecutive positions in
a string. The characters immediately before and after will not be one
of ASDF. Can you give some examples of what you are trying to match,
with some sample strings that match and some that do not?

You can use "zero-width negative lookahead (?=...) and -behind (?!...)"
assertions to customize what should precede and follow any match, if
that helps.

FYI: this newsgroup is defunct; try comp.lang.perl.misc in the future.
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
Aug 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

20 posts views Thread by Toby | last post: by
7 posts views Thread by Patient Guy | last post: by
7 posts views Thread by norton | last post: by
4 posts views Thread by Egyd Csaba | last post: by
7 posts views Thread by Billa | last post: by
6 posts views Thread by Ludwig | last post: by
25 posts views Thread by Mike | last post: by
12 posts views Thread by =?Utf-8?B?SlA=?= | last post: by
12 posts views Thread by FAQEditor | last post: by
9 posts views Thread by Rene | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.