Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does this regex means? [closed]

Tags:

java

regex

I find this java regex, but don't understand what does it match?

Pattern.compile("\\p{javaJavaIdentifierStart}\\p{javaJavaIdentifierPart}*(\\.\\p{javaJavaIdentifierStart}\\p{javaJavaIdentifierPart}*)*");

What javaJavaIdentifierStart matches?

like image 286
Xelian Avatar asked Sep 14 '25 17:09

Xelian


1 Answers

\\p{javaJavaIdentifierStart} means a character acceptable to be the first character of any valid java identifier.

\\p{javaJavaIdentifierStart}\\p{javaJavaIdentifierPart}*\\.\\p{javaJavaIdentifierStart}\\p{javaJavaIdentifierPart}* means anyIdentifier.anyIdentifier - two java identifiers, separated by dot (namespace name and class name, class name and static member name, object name and member name or etc.)

Full (corrected) regex means (maybe qualified) java identifier - simple "name" or a chain of "names", separated by dots. It is not neccessary for it to be a fully qualified name though.

like image 66
mas.morozov Avatar answered Sep 16 '25 06:09

mas.morozov