Java Regular Expressions: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 10: Line 10:
=Overview=
=Overview=


=API=
=java.util.regex API=


The general pattern for using regular expressions is the following:
The general pattern for using regular expressions is the following:
Line 20: Line 20:


{{External|https://github.com/NovaOrdis/playground/tree/master/java/regex/simplest}}
{{External|https://github.com/NovaOrdis/playground/tree/master/java/regex/simplest}}
=java.langString API=
<syntaxhighlight lang='java'>
String s = "...";
s.matches(...);
</syntaxhighlight>


=Concurrent Usage Considerations=
=Concurrent Usage Considerations=


{{Warn|Matcher instances are NOT thread safe, create a matcher per thread}}
{{Warn|Matcher instances are NOT thread safe, create a matcher per thread}}

Revision as of 21:18, 29 July 2017

External

Internal

Overview

java.util.regex API

The general pattern for using regular expressions is the following:

Working code is available here:

https://github.com/NovaOrdis/playground/tree/master/java/regex/simplest


java.langString API

String s = "...";
s.matches(...);

Concurrent Usage Considerations


Matcher instances are NOT thread safe, create a matcher per thread