Android Regular Expressions

Source: Internet
Author: User
<span id="Label3"></p><p><p>1. Related Knowledge link</p></p><p><p>Regular expression Syntax https://msdn.microsoft.com/zh-cn/library/ae5bf541 (v=vs.80). aspx</p></p><p><p>Regular expressions Getting Started tutorial http://www.jb51.net/tools/zhengze.html</p></p><p><p>2. Split string</p></p><p><p></p></p><pre><span style="color: #0000ff;"><span style="color: #0000ff;"></span> package</span><span style="color: #000000;"><span style="color: #000000;">com.app;</span></span><span style="color: #0000ff;"><span style="color: #0000ff;"></span> public</span> <span style="color: #0000ff;"><span style="color: #0000ff;">class</span></span><span style="color: #000000;"><span style="color: #000000;">AA {</span></span><span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;">pattern <span style="color: #008000;">(schema Class) and Matcher (match class). </span></span><span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;">the <span style="color: #008000;">pattern class is the object that is used to express and state the pattern to be searched.</span></span><span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">the Matcher class is the object that really affects the Search. </span></span><span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">plus a new exception class, patternsyntaxexception, when an illegal search pattern is encountered</span> , an exception is thrown</span> <span style="color: #0000ff;"><span style="color: #0000ff;"></span> public</span> <span style="color: #0000ff;"><span style="color: #0000ff;">Static</span></span> <span style="color: #0000ff;"><span style="color: #0000ff;">void</span></span><span style="color: #000000;"><span style="color: #000000;">main (string[] Args) {String s</span></span>= "shanglvgj001^3478^105^14"<span style="color: #000000;"><span style="color: #000000;"> ; string[] names</span></span>= S.split ("\\^"<span style="color: #000000;"><span style="color: #000000;">) ; </span></span><span style="color: #0000ff;"><span style="color: #0000ff;"></span> for</span>(<span style="color: #0000ff;"><span style="color: #0000ff;">int</span></span>i = 0; I < names.length; i++<span style="color: #000000;"><span style="color: #000000;">) {System.out.println (names[i]); } }}</span></span></pre><p><p></p></p><p><p>Operation Result:<br>shanglvgj001<br>3478<br>105<br>14</p></p><p><p></p></p><p><p></p></p><p><p>Android Regular Expressions</p></p></span>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.