<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: regular expression in perl in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-in-perl/m-p/2731214#M836271</link>
    <description>Sorry, I had a typo!&lt;BR /&gt;&lt;BR /&gt;Your example works fine!!&lt;BR /&gt;&lt;BR /&gt;Thanks a lot!</description>
    <pubDate>Fri, 24 May 2002 14:13:00 GMT</pubDate>
    <dc:creator>andi_1</dc:creator>
    <dc:date>2002-05-24T14:13:00Z</dc:date>
    <item>
      <title>regular expression in perl</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-in-perl/m-p/2731209#M836266</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;I have the following format:&lt;BR /&gt;&lt;BR /&gt;email address = email@email.com&lt;BR /&gt;&lt;BR /&gt;Does anyone know how can I guarantee to retrieve email@email.com and assign it to a variable?&lt;BR /&gt;&lt;BR /&gt;Thank you!</description>
      <pubDate>Fri, 24 May 2002 13:19:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-in-perl/m-p/2731209#M836266</guid>
      <dc:creator>andi_1</dc:creator>
      <dc:date>2002-05-24T13:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: regular expression in perl</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-in-perl/m-p/2731210#M836267</link>
      <description>Can you elaborate on that question? If you just want to parse that line, it is something like&lt;BR /&gt;&lt;BR /&gt;my ($address) = (m/email\s*address\s*=\s*(\S.*)/);</description>
      <pubDate>Fri, 24 May 2002 13:40:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-in-perl/m-p/2731210#M836267</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2002-05-24T13:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: regular expression in perl</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-in-perl/m-p/2731211#M836268</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Basically, my perl file will be feed a file, where I need to search for a specific field, email address:&lt;BR /&gt;the file will have email field formatted this way:&lt;BR /&gt;email address = email@email.com&lt;BR /&gt;&lt;BR /&gt;here is my perl code:&lt;BR /&gt;while($line = &lt;STDIN&gt;)&lt;BR /&gt;{&lt;BR /&gt;    if ($line =~ /^email address/)&lt;BR /&gt;    {&lt;BR /&gt; my ($address) = (m/email\s*address\s*=\s*(\S.*)/);&lt;BR /&gt; print  $address;&lt;BR /&gt;    }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;basically, $line will be "email address = email@email.com"&lt;BR /&gt;&lt;BR /&gt;Than, I will need to basically, to parse $line and assign email value to a local variable.&lt;BR /&gt;&lt;BR /&gt;I tried your way, but when I print $address, nothing is displayed.&lt;BR /&gt;&lt;BR /&gt;Thanks for your help!&lt;/STDIN&gt;</description>
      <pubDate>Fri, 24 May 2002 13:47:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-in-perl/m-p/2731211#M836268</guid>
      <dc:creator>andi_1</dc:creator>
      <dc:date>2002-05-24T13:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: regular expression in perl</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-in-perl/m-p/2731212#M836269</link>
      <description>that's because my example uses the default buffer ($_), whereas you've read your line in $line. Go either way:&lt;BR /&gt;&lt;BR /&gt;1---&lt;BR /&gt;while(&lt;STDIN&gt;)&lt;BR /&gt;{&lt;BR /&gt;if (m/^email address/)&lt;BR /&gt;{&lt;BR /&gt;my ($address) = (m/email\s*address\s*=\s*(\S.*)/);&lt;BR /&gt;print $address;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;---&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;2---&lt;BR /&gt;while($line = &lt;STDIN&gt;)&lt;BR /&gt;{&lt;BR /&gt;if ($line =~ /^email address/)&lt;BR /&gt;{&lt;BR /&gt;my ($address) = ($line =~ m/email\s*address\s*=\s*(\S.*)/);&lt;BR /&gt;print $address;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;---&lt;BR /&gt;&lt;BR /&gt;also possible:&lt;BR /&gt;&lt;BR /&gt;3---&lt;BR /&gt;while(&lt;STDIN&gt;)&lt;BR /&gt;{&lt;BR /&gt;if ($line =~ m/^email address = (.*)/)&lt;BR /&gt;{&lt;BR /&gt;my $address = $1;&lt;BR /&gt;print $address;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;---&lt;BR /&gt;&lt;BR /&gt;note also that your code is quite rigid with spaces. compare&lt;BR /&gt;&lt;BR /&gt;m/^email address = (.*)/&lt;BR /&gt;&lt;BR /&gt;to&lt;BR /&gt;&lt;BR /&gt;m/\bemail\s+address\s*=\s*(\S.*)/&lt;BR /&gt;&lt;/STDIN&gt;&lt;/STDIN&gt;&lt;/STDIN&gt;</description>
      <pubDate>Fri, 24 May 2002 13:54:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-in-perl/m-p/2731212#M836269</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2002-05-24T13:54:32Z</dc:date>
    </item>
    <item>
      <title>Re: regular expression in perl</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-in-perl/m-p/2731213#M836270</link>
      <description>Thanks a lot for your help!&lt;BR /&gt;&lt;BR /&gt;Here is what I have:&lt;BR /&gt;&lt;BR /&gt;while($line = &lt;STDIN&gt;)&lt;BR /&gt;{&lt;BR /&gt;    if ($line = m/^email address/)&lt;BR /&gt;    {&lt;BR /&gt; &lt;BR /&gt; my ($address) = ($line =~ m/\bemail\s+address\s*=\s(\S.*)/);&lt;BR /&gt; print  $address;&lt;BR /&gt;    }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;my template contains the following line:&lt;BR /&gt;&lt;BR /&gt;email address = lz@yahoo.com&lt;BR /&gt;&lt;BR /&gt;For some reasons, print $address doesn't display anything. ;-(&lt;BR /&gt;&lt;BR /&gt;Thanks again!&lt;/STDIN&gt;</description>
      <pubDate>Fri, 24 May 2002 14:08:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-in-perl/m-p/2731213#M836270</guid>
      <dc:creator>andi_1</dc:creator>
      <dc:date>2002-05-24T14:08:48Z</dc:date>
    </item>
    <item>
      <title>Re: regular expression in perl</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-in-perl/m-p/2731214#M836271</link>
      <description>Sorry, I had a typo!&lt;BR /&gt;&lt;BR /&gt;Your example works fine!!&lt;BR /&gt;&lt;BR /&gt;Thanks a lot!</description>
      <pubDate>Fri, 24 May 2002 14:13:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-in-perl/m-p/2731214#M836271</guid>
      <dc:creator>andi_1</dc:creator>
      <dc:date>2002-05-24T14:13:00Z</dc:date>
    </item>
  </channel>
</rss>

