Click here to Skip to main content
15,606,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone.
After a week of searching the web and trying different approaches, i give up.
I am facing an issue with regEx in Java and i am wondering if i can find some help here.
I am trying to find this "< < < < 06 76 > > " pattern in a huge string that i have to search through.
What i know is that, between the last "<" and the first ">" there can only be numbers type characters and any amount of spaces between the last ">" and the first "<". Also, between each "<" or ">" can be from 1 to 5 spaces.
I was able to create part of a pattern to use for my search, but i cant move forward from there.

I am stuck trying to include the idea of "any numbers, not more than 4 digits, separated by 1 to 5 spaces".

Finally, i am able to "close" the pattern to be searched with
Sorry for the long text. I am trying to be as detailed as possible.
Thanks so much!

What I have tried:

Here is what i was able to create as a search pattern.

String tag_open = "<\\s{0,4}<\\s{0,4}<\\s{0,4}<\\s{0,4}";
Updated 27-Jun-21 2:41am
Patrice T 27-Jun-21 8:16am    
Show samples of what you want to match and samples of what should not match with explanations for each samples.
Use Improve question to update your question.

1 solution

For a regex, "\d" is a digit - it will only match the characters '0' to '9'.
Try this:

If you are going to work with regular expressions, a tool can help a lot: Get a copy of Expresso[^] - it's free, and it examines and generates Regular expressions.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900