Message Boards Message Boards

1
|
6591 Views
|
3 Replies
|
3 Total Likes
View groups...
Share
Share this post:

[?] Use Except in a RegularExpression?

Friends: Can Except be used in Regular Expressions? And then how? This is potentially quite useful. Suppose I want to match a pattern with the class character [A-Z] but without the class character [B-D]. This seems to be a job for combined regular expressions and Except...But then how to do it? Any help is welcome, Francisco

3 Replies

This is excellent and works perfectly.

Sorry for the absurd delay in answering you kind feedback. This seems obviously rude. But it has an explanation. I simply stopped receiving notifications from the Wolfram community at my email box and completely forgot to come back.

I suddenly started getting notifications back, and here I am

So thanks again Francisco

Posted 6 years ago
teststring="adefghbchbcdecdbllbbbbo12c34bcbcbcyyy";
StringCases[teststring, (Except[CharacterRange["b","d"],CharacterRange["a","z"]])..]

you don't gain anything by using the regular expression

StringCases[teststring, RegularExpression["(?ms)(?:(?=[^bcd])[a-z])+"]]
POSTED BY: Raspi Rascal
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract