Java – regular expression lookup substring
•
Java
Suppose I have a substring BB, which can be separate or part of a longer string, such as BB or AA | BB | CC or BB | CC or AA | BB, that is, if it follows / follows another substring, it must be separated by | In any of the above, what regular expressions do I need to find instead of AABB?
Solution
I think this will do:
^(.+[|])?BB([|].+)?$
After testing here, I'll say yes, that's it
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码