forked from bortzmeyer/Web-LangTag
15 lines
918 B
XML
15 lines
918 B
XML
|
<page title="Addison Phillips Java regexp for language tags">
|
||
|
<p>Here is a <wikipedia>regular expression</wikipedia> to parse the <em>future</em> versions of
|
||
|
<a href="index.html">language tags</a>. Suitable for the syntax of the RFC 5646. Written by Addison Phillips, <code>addison - at - amazon.com</code> for the <wikipedia name="Java (programming language)">Java programming language</wikipedia>.</p>
|
||
|
<pre>
|
||
|
static final String langtag_ex =
|
||
|
"(\\A[xX]([\\x2d]\\p{Alnum}{1,8})*\\z)"
|
||
|
+ "|(((\\A\\p{Alpha}{2,8}(?=\\x2d|\\z)){1}"
|
||
|
+ "(([\\x2d]\\p{Alpha}{3})(?=\\x2d|\\z)){0,3}"
|
||
|
+ "([\\x2d]\\p{Alpha}{4}(?=\\x2d|\\z))?"
|
||
|
+ "([\\x2d](\\p{Alpha}{2}|\\d{3})(?=\\x2d|\\z))?"
|
||
|
+ "([\\x2d](\\d\\p{Alnum}{3}|\\p{Alnum}{5,8})(?=\\x2d|\\z))*)"
|
||
|
+ "(([\\x2d]([a-wyzA-WYZ](?=\\x2d))([\\x2d](\\p{Alnum}{2,8})+)*))*"
|
||
|
+ "([\\x2d][xX]([\\x2d]\\p{Alnum}{1,8})*)?)\\z";
|
||
|
</pre>
|
||
|
</page>
|