<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.theeggeadventure.com/wikimedia/index.php?action=history&amp;feed=atom&amp;title=ReplaceAll_with_Backreferences</id>
	<title>ReplaceAll with Backreferences - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.theeggeadventure.com/wikimedia/index.php?action=history&amp;feed=atom&amp;title=ReplaceAll_with_Backreferences"/>
	<link rel="alternate" type="text/html" href="https://www.theeggeadventure.com/wikimedia/index.php?title=ReplaceAll_with_Backreferences&amp;action=history"/>
	<updated>2026-05-12T21:20:59Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.0-beta</generator>
	<entry>
		<id>https://www.theeggeadventure.com/wikimedia/index.php?title=ReplaceAll_with_Backreferences&amp;diff=2241&amp;oldid=prev</id>
		<title>Brianegge: Created page with &#039;Regex functions can give you fast replacements in Java, along with the readability of Perl.  Here&#039;s an example of using a replaceAll to mask out certain digits in a credit card n…&#039;</title>
		<link rel="alternate" type="text/html" href="https://www.theeggeadventure.com/wikimedia/index.php?title=ReplaceAll_with_Backreferences&amp;diff=2241&amp;oldid=prev"/>
		<updated>2009-10-09T02:40:11Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;#039;Regex functions can give you fast replacements in Java, along with the readability of Perl.  Here&amp;#039;s an example of using a replaceAll to mask out certain digits in a credit card n…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Regex functions can give you fast replacements in Java, along with the readability of Perl.  Here&amp;#039;s an example of using a replaceAll to mask out certain digits in a credit card number.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;geshi lang=&amp;quot;java5&amp;quot;&amp;gt;&lt;br /&gt;
        String account = &amp;quot;1234567890123456&amp;quot;;&lt;br /&gt;
        String replacement = account.replaceAll(&amp;quot;(\\d{4})(\\d{2})(\\d{6})(\\d{4})&amp;quot;, &amp;quot;$1 $2XX XXXX $4&amp;quot;);&lt;br /&gt;
        assertEquals(&amp;quot;1234 56XX XXXX 3456&amp;quot;, replacement);&lt;br /&gt;
&amp;lt;/geshi&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another fun regex can simulate the the unix &amp;#039;basename&amp;#039; function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;geshi lang=&amp;quot;java5&amp;quot;&amp;gt;&lt;br /&gt;
assertEquals(&amp;quot;RegexTest&amp;quot;, this.getClass().getName().replaceAll(&amp;quot;(?:\\w+\\.)*(\\w+)&amp;quot;, &amp;quot;$1&amp;quot;));&lt;br /&gt;
&amp;lt;/geshi&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Java]]&lt;br /&gt;
[[Category:Regex]]&lt;/div&gt;</summary>
		<author><name>Brianegge</name></author>
	</entry>
</feed>