<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body><div>How about if you split () on Co. Mas, and then just check the elements of the array for the values you want?</div><div><br></div><div>You pattern captures into separate variables : two digits, a dot, two digits, a dot, another two digits. From your description you want to the whole thing: </div><div><br></div><div> /(\d{2}\.\d {2}\.\d {2})/</div><div><br></div><div>OR a bit sloppily, but valid </div><div><br></div><div> /([0-9.]{8})/</div><div><br></div><div>It matches non valid strings, but you say those won't happen. Or by adding an 'x' flag, you can comment your regex. </div><div><br></div><div> / ( # capture</div><div> [0-9.] {8} # 8 chars which are digit or dot</div><div> ) /'</div><div><br></div><div><br></div><div>Probably more useful in more complex instances.</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div id="composer_signature"><div style="font-size:85%;color:#575757" dir="auto">Sent from my Samsung Galaxy smartphone.</div></div><div><br></div><div style="font-size:100%;color:#000000"><!-- originalMessage --><div>-------- Original message --------</div><div>From: Rob Janes <janes.rob@gmail.com> </div><div>Date: 2016-08-11 11:29 (GMT-05:00) </div><div>To: Chris Jones <cj@enersave.ca> </div><div>Cc: toronto-pm@pm.org </div><div>Subject: Re: [tpm] Regex assistance </div><div><br></div></div><p dir="ltr">^,* in front then |(\d\d\.\d\d\d),*$ after?</p>
<p dir="ltr">Ok replace bar with ,.*,</p>
<div class="gmail_quote">On Aug 11, 2016 10:38 AM, "Chris Jones" <<a href="mailto:cj@enersave.ca">cj@enersave.ca</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Hello Perl Mongers,<br>
<br>
I am looking for assistance with a regex. I have a bunch of strings in for form:<br>
<br>
"01.03.16,,Studio one, Space 22,1 500,500,01.051,,"<br>
or<br>
",01.03.16,,Studio one, Space 22,1 500,500,01.051,"<br>
or<br>
",01.03.16,,Studio one, Space 22,1 500,500,01.051,,"<br>
or<br>
",01.03.16,,Studio one, Space 22, ,01.051,,"<br>
<br>
So the middle section can be one or more comma separated strings.<br>
<br>
I am trying to match and return the first non-blank pattern and the last non-blank pattern<br>
01.03.16 and 01.051 – these numbering formats are always the same: xx.xx.xx and yy.yyy<br>
<br>
So far I have a regex that matches the first pattern:<br>
<br>
"([0-9]{2})([\.])([0-9]{2})([\<wbr>.])([0-9]{2})"<br>
<br>
In any of those above example.<br>
<br>
I am stuck after that.<br>
Any insights appreciated!<br>
<br>
<br>
<br>
-- <br>
<br>
Chris Jones<br>
14 Oneida Avenue<br>
Toronto, ON M5J 2E3<br>
<a href="tel:416-697-0056" value="+14166970056" target="_blank">416-697-0056</a><br>
<br>
______________________________<wbr>_________________<br>
toronto-pm mailing list<br>
<a href="mailto:toronto-pm@pm.org" target="_blank">toronto-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/toronto-pm" rel="noreferrer" target="_blank">http://mail.pm.org/mailman/lis<wbr>tinfo/toronto-pm</a><br>
</blockquote></div>
</body></html>