<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://www.freebsdwiki.net/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.freebsdwiki.net/index.php?action=history&amp;feed=atom&amp;title=Perl%2C_regex_searches</id>
		<title>Perl, regex searches - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://www.freebsdwiki.net/index.php?action=history&amp;feed=atom&amp;title=Perl%2C_regex_searches"/>
		<link rel="alternate" type="text/html" href="http://www.freebsdwiki.net/index.php?title=Perl,_regex_searches&amp;action=history"/>
		<updated>2026-05-01T18:17:56Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.18.0</generator>

	<entry>
		<id>http://www.freebsdwiki.net/index.php?title=Perl,_regex_searches&amp;diff=11472&amp;oldid=prev</id>
		<title>Jimbo at 03:53, 7 October 2009</title>
		<link rel="alternate" type="text/html" href="http://www.freebsdwiki.net/index.php?title=Perl,_regex_searches&amp;diff=11472&amp;oldid=prev"/>
				<updated>2009-10-07T03:53:47Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 03:53, 7 October 2009&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 25:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 25:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Not what you expected, was it?&amp;#160; So remember, if you are using match values OUTSIDE the regular expression they occur in, ALWAYS use the form '''(my $one,my $two,my $three) = ($string =~ /(one)...(two)...(three)/);''' or you'll get into trouble.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Not what you expected, was it?&amp;#160; So remember, if you are using match values OUTSIDE the regular expression they occur in, ALWAYS use the form '''(my $one,my $two,my $three) = ($string =~ /(one)...(two)...(three)/);''' or you'll get into trouble.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Common Tasks]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key bsdwiki:diff:version:1.11a:oldid:11441:newid:11472 --&gt;
&lt;/table&gt;</summary>
		<author><name>Jimbo</name></author>	</entry>

	<entry>
		<id>http://www.freebsdwiki.net/index.php?title=Perl,_regex_searches&amp;diff=11441&amp;oldid=prev</id>
		<title>Jimbo at 21:00, 30 September 2009</title>
		<link rel="alternate" type="text/html" href="http://www.freebsdwiki.net/index.php?title=Perl,_regex_searches&amp;diff=11441&amp;oldid=prev"/>
				<updated>2009-09-30T21:00:34Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;To extract values from a string using regular expressions in Perl, the format looks like this:&lt;br /&gt;
&lt;br /&gt;
 $time = '18:03:34';&lt;br /&gt;
 (my $hours, my $minutes, my $seconds) = ($time =~ /(\d\d):(\d\d):(\d\d)/);&lt;br /&gt;
&lt;br /&gt;
Beware of trying to use matches based on $1, $2, $3, and such in expressions after the actual match - the results are unpredictable.  For example, consider the following code:&lt;br /&gt;
&lt;br /&gt;
 $time = '18:03:34';&lt;br /&gt;
 $time =~ /(\d\d):(\d\d):(\d\d)/;&lt;br /&gt;
 $hours = $1;&lt;br /&gt;
 $minutes = $2;&lt;br /&gt;
 $seconds = $3;&lt;br /&gt;
 print &amp;quot;The first time is $hours:$minutes:$seconds.\n&amp;quot;;&lt;br /&gt;
 $time = '19:04:55';&lt;br /&gt;
 $time =~ /(\d\d):(\d\d):(\d\d)/;&lt;br /&gt;
 $hours = $1;&lt;br /&gt;
 $minutes = $2;&lt;br /&gt;
 $seconds = $3;&lt;br /&gt;
 print &amp;quot;The second time is $hours:$minutes:$seconds.\n&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
This code produces the following results:&lt;br /&gt;
&lt;br /&gt;
 The first time is 18:03:34.&lt;br /&gt;
 The second time is 18:03:34.&lt;br /&gt;
&lt;br /&gt;
Not what you expected, was it?  So remember, if you are using match values OUTSIDE the regular expression they occur in, ALWAYS use the form '''(my $one,my $two,my $three) = ($string =~ /(one)...(two)...(three)/);''' or you'll get into trouble.&lt;/div&gt;</summary>
		<author><name>Jimbo</name></author>	</entry>

	</feed>