<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FRegular_Expressions%2FSerialization</id>
		<title>Java/Regular Expressions/Serialization - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FRegular_Expressions%2FSerialization"/>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/Regular_Expressions/Serialization&amp;action=history"/>
		<updated>2026-04-22T03:31:26Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java/Regular_Expressions/Serialization&amp;diff=6029&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/Regular_Expressions/Serialization&amp;diff=6029&amp;oldid=prev"/>
				<updated>2010-06-01T06:00:52Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 06:00, 1 июня 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java/Regular_Expressions/Serialization&amp;diff=6028&amp;oldid=prev</id>
		<title> в 18:01, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/Regular_Expressions/Serialization&amp;diff=6028&amp;oldid=prev"/>
				<updated>2010-05-31T18:01:43Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Apply Regular Expressions on the contents of a file ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
import java.io.FileInputStream;&lt;br /&gt;
import java.nio.ByteBuffer;&lt;br /&gt;
import java.nio.CharBuffer;&lt;br /&gt;
import java.nio.channels.FileChannel;&lt;br /&gt;
import java.nio.charset.Charset;&lt;br /&gt;
import java.util.regex.Matcher;&lt;br /&gt;
import java.util.regex.Pattern;&lt;br /&gt;
public class Main {&lt;br /&gt;
  public static void main(String[] argv) throws Exception {&lt;br /&gt;
    Pattern pattern = Pattern.rupile(&amp;quot;pattern&amp;quot;);&lt;br /&gt;
    FileInputStream input = new FileInputStream(&amp;quot;file.txt&amp;quot;);&lt;br /&gt;
    FileChannel channel = input.getChannel();&lt;br /&gt;
    ByteBuffer bbuf = channel.map(FileChannel.MapMode.READ_ONLY, 0, (int) channel.size());&lt;br /&gt;
    CharBuffer cbuf = Charset.forName(&amp;quot;8859_1&amp;quot;).newDecoder().decode(bbuf);&lt;br /&gt;
    Matcher matcher = pattern.matcher(cbuf);&lt;br /&gt;
    while (matcher.find()) {&lt;br /&gt;
      String match = matcher.group();&lt;br /&gt;
      System.out.println(match);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Reading Lines from a String Using a Regular Expression ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
import java.util.regex.Matcher;&lt;br /&gt;
import java.util.regex.Pattern;&lt;br /&gt;
public class Main {&lt;br /&gt;
  public static void main(String[] argv) throws Exception {&lt;br /&gt;
    CharSequence inputStr = &amp;quot;a\rb&amp;quot;; &lt;br /&gt;
    inputStr = &amp;quot;a\r\nb&amp;quot;; &lt;br /&gt;
    inputStr = &amp;quot;a\nb&amp;quot;; &lt;br /&gt;
    String patternStr = &amp;quot;^(.*)$&amp;quot;;&lt;br /&gt;
    Pattern pattern = Pattern.rupile(patternStr, Pattern.MULTILINE);&lt;br /&gt;
    Matcher matcher = pattern.matcher(inputStr);&lt;br /&gt;
    while (matcher.find()) {&lt;br /&gt;
      String lineWithTerminator = matcher.group(0);&lt;br /&gt;
      String lineWithoutTerminator = matcher.group(1);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Use FileChannels and ByteBuffers to Store Patterns ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
//Example File&lt;br /&gt;
/*       &lt;br /&gt;
#Email validator that adheres directly to the specification&lt;br /&gt;
#for email address naming. It allows for everything from&lt;br /&gt;
#ipaddress and country-code domains to very rare characters&lt;br /&gt;
#in the username.&lt;br /&gt;
email=^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-&lt;br /&gt;
9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-&lt;br /&gt;
9]{1,3})(\]?)$&lt;br /&gt;
#Matches UK postcodes according to the following rules 1. LN NLL&lt;br /&gt;
#eg N1 1AA 2. LLN NLL eg SW4 0QL 3. LNN NLL eg M23 4PJ 4. LLNN NLL&lt;br /&gt;
#eg WS14 0JT 5. LLNL NLL eg SW1N 4TB 6. LNL NLL eg W1C 8LQ Thanks&lt;br /&gt;
#to Simon Bell for informin ...&lt;br /&gt;
zip=^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$&lt;br /&gt;
#This regular expression matches dates of the form XX/XX/YYYY&lt;br /&gt;
#where XX can be 1 or 2 digits long and YYYY is always 4&lt;br /&gt;
#digits long.&lt;br /&gt;
dates=^\d{1,2}\/\d{1,2}\/\d{4}$&lt;br /&gt;
*/&lt;br /&gt;
import java.util.Properties;&lt;br /&gt;
import java.util.regex.*;&lt;br /&gt;
import java.util.*;&lt;br /&gt;
import java.io.*;&lt;br /&gt;
import java.nio.*;&lt;br /&gt;
import java.nio.channels.*;&lt;br /&gt;
import java.util.logging.Logger;&lt;br /&gt;
public class RegexProperties extends Properties {&lt;br /&gt;
  private static Logger log = Logger.getAnonymousLogger();&lt;br /&gt;
  public void load(String inStream) throws IOException,&lt;br /&gt;
      PatternSyntaxException {&lt;br /&gt;
    load(new FileInputStream(inStream));&lt;br /&gt;
  }&lt;br /&gt;
  public void load(FileInputStream inStream) throws IOException,&lt;br /&gt;
      PatternSyntaxException {&lt;br /&gt;
    FileChannel fc = inStream.getChannel();&lt;br /&gt;
    ByteBuffer bb = ByteBuffer.allocate((int) fc.size());&lt;br /&gt;
    fc.read(bb);&lt;br /&gt;
    bb.flip();&lt;br /&gt;
    String fileContent = new String(bb.array());&lt;br /&gt;
    Pattern pattern = Pattern.rupile(&amp;quot;^(.*)$&amp;quot;, Pattern.MULTILINE);&lt;br /&gt;
    Matcher matcher = pattern.matcher(fileContent);&lt;br /&gt;
    while (matcher.find()) {&lt;br /&gt;
      String line = matcher.group(1);&lt;br /&gt;
      if (line != null &amp;amp;&amp;amp; !&amp;quot;&amp;quot;.equals(line.trim())&lt;br /&gt;
          &amp;amp;&amp;amp; !line.startsWith(&amp;quot;#&amp;quot;) &amp;amp;&amp;amp; !line.startsWith(&amp;quot;!&amp;quot;)) {&lt;br /&gt;
        String keyValue[] = null;&lt;br /&gt;
        if (line.indexOf(&amp;quot;=&amp;quot;) &amp;gt; 0)&lt;br /&gt;
          keyValue = line.split(&amp;quot;=&amp;quot;, 2);&lt;br /&gt;
        else&lt;br /&gt;
          keyValue = line.split(&amp;quot;:&amp;quot;, 2);&lt;br /&gt;
        if (keyValue != null) {&lt;br /&gt;
          super.put(keyValue[0].trim(), keyValue[1]);&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    fc = null;&lt;br /&gt;
    bb = null;&lt;br /&gt;
  }&lt;br /&gt;
  public void store(FileOutputStream out, String header)&lt;br /&gt;
      throws UnsupportedOperationException {&lt;br /&gt;
    throw new UnsupportedOperationException(&amp;quot;unsupported for this class&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  public void putAll(Map t) {&lt;br /&gt;
    throw new UnsupportedOperationException(&amp;quot;unsupported for this class&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Using a Regular Expression to Filter Lines from a Reader ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
import java.io.BufferedReader;&lt;br /&gt;
import java.io.FileReader;&lt;br /&gt;
import java.util.regex.Matcher;&lt;br /&gt;
import java.util.regex.Pattern;&lt;br /&gt;
public class Main {&lt;br /&gt;
  public static void main(String[] argv) throws Exception {&lt;br /&gt;
    String filename = &amp;quot;infile.txt&amp;quot;;&lt;br /&gt;
    String patternStr = &amp;quot;pattern&amp;quot;;&lt;br /&gt;
    BufferedReader rd = new BufferedReader(new FileReader(filename));&lt;br /&gt;
    Pattern pattern = Pattern.rupile(patternStr);&lt;br /&gt;
    Matcher matcher = pattern.matcher(&amp;quot;\\D&amp;quot;);&lt;br /&gt;
    String line = null;&lt;br /&gt;
    while ((line = rd.readLine()) != null) {&lt;br /&gt;
      matcher.reset(line);&lt;br /&gt;
      if (matcher.find()) {&lt;br /&gt;
        // line matches the pattern&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;/div&gt;</summary>
			</entry>

	</feed>