Alejandro L.
Alejandro L.

Reputation: 1076

Using regular expression with Java (some specific characters)

I have this example:

String str = "HellMCo I fiCZMnd thBVMis site intZereVCsting";
String tags = "BCMVZ";

I need a regular expression that helps me to find every combination of tags. As you can see in str we find four variations. I don't know too much about regular expressions.

I'm starting to test with this pattern:

(\d{,1}[BCMVZ])

PD: I'm testing here http://regexpal.com/ but it doesn't work my pattern.

So my real question is, how can I detect any variation of any character from another string?

Upvotes: 0

Views: 80

Answers (1)

Victor Bocharsky
Victor Bocharsky

Reputation: 12306

Maybe try someting like:

[BCMVZ]+

it find any tags combinations with this chars BCMVZ.

Upvotes: 2

Related Questions