Hi Folks : I'm trying to create a regular expression for finding a # wishing a dataset for only a number that is a multiple of 5

--000000000000ef7dcd0592108b41
Content-Type: text/plain; charset="UTF-8"

Do you guys have any pointers ?

Thanks

Gautam S Desai

kidsforchess.org

https://www.facebook.com/kidsforchess.suwanee.9

https://www.21stcenturyleaders.org/youth-ambassador-starts-nonprofit-donates-to-21cl/

--000000000000ef7dcd0592108b41
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Do you guys have any pointers ?=C2=A0<div><br></div><div>T=
hanks</div><div><br clear=3D"all"><div><div dir=3D"ltr" class=3D"gmail_sign=
ature" data-smartmail=3D"gmail_signature"><div dir=3D"ltr"><div style=3D"ma=
rgin:0px;padding:0px 0px 20px;width:872px"><div><div style=3D"margin:8px 0p=
x 0px;padding:0px"><div><div dir=3D"ltr"><span><font color=3D"#888888"><div=
 dir=3D"ltr" style=3D"font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-s=
erif;font-size:12.8px">Gautam S Desai<br><br><a href=3D"http://kidsforchess=
..org/" target=3D"_blank">kidsforchess.org</a><br><br><a href=3D"https://www=
..facebook.com/kidsforchess.suwanee.9" target=3D"_blank">https://www.faceboo=
k.com/kidsforchess.suwanee.9</a></div><div dir=3D"ltr" style=3D"font-family=
:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:12.8px"><br></div>=
<div dir=3D"ltr"><a href=3D"https://www.21stcenturyleaders.org/youth-ambass=
ador-starts-nonprofit-donates-to-21cl/" target=3D"_blank">https://www.21stc=
enturyleaders.org/youth-ambassador-starts-nonprofit-donates-to-21cl/</a></d=
iv><div dir=3D"ltr"><br><br></div><div dir=3D"ltr" style=3D"font-family:Rob=
oto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:12.8px"><br></div></fo=
nt></span></div><div style=3D"font-family:Roboto,RobotoDraft,Helvetica,Aria=
l,sans-serif;font-size:12.8px"></div></div></div><div style=3D"font-family:=
Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:medium"></div></div=
></div></div></div></div></div></div>

--000000000000ef7dcd0592108b41--
0
gautam
9/8/2019 8:30:37 PM
perl.beginners 29360 articles. 3 followers. Follow

7 Replies
8 Views

Similar Articles

[PageSpeed] 21

On Sep 8, 2019, at 1:30 PM, Gautam Desai <gautam.satya.desai@gmail.com> =
wrote:
>=20
> Do you guys have any pointers ?=20

	$t =3D~ m{=20
		(		# capture matched number in $1
		  \d*  	# match zero or more decimal digits
		  [05]	# followed by a '0' or '5'
		)		# end of capture
		(?:		# followed by either:
		  \D 	        # a non-digit
		|		# or
		  $		# the end of the string=20
		)=20
		}x=20
0
Jim
9/8/2019 9:34:01 PM
It's probably best if you write a short script
that reads a __DATA__ section of data.
Then tell us what it does and what you expected
it to do.

Off hand I don't see anything wrong with your regex,
but I don't know what you expect it to do.


Mike


On 9/8/2019 4:34 PM, Jim Gibson wrote:
> On Sep 8, 2019, at 1:30 PM, Gautam Desai <gautam.satya.desai@gmail.com> wrote:
>> Do you guys have any pointers ?
> 	$t =~ m{
> 		(		# capture matched number in $1
> 		  \d*  	# match zero or more decimal digits
> 		  [05]	# followed by a '0' or '5'
> 		)		# end of capture
> 		(?:		# followed by either:
> 		  \D 	        # a non-digit
> 		|		# or
> 		  $		# the end of the string
> 		)
> 		}x
>
0
temp4
9/8/2019 10:39:38 PM
On Sep 8, 2019, at 3:39 PM, Mike <temp4@mflan.com> wrote:
>=20
>=20
> It's probably best if you write a short script
> that reads a __DATA__ section of data.
> Then tell us what it does and what you expected
> it to do.
>=20
> Off hand I don't see anything wrong with your regex,
> but I don't know what you expect it to do.
>=20

I expect it to return a positive value if $t contains a number anywhere =
within it and put that number in the $1 capture variable.

>=20
> Mike
>=20
>=20
> On 9/8/2019 4:34 PM, Jim Gibson wrote:
>> On Sep 8, 2019, at 1:30 PM, Gautam Desai =
<gautam.satya.desai@gmail.com> wrote:
>>> Do you guys have any pointers ?
>> 	$t =3D~ m{
>> 		(		# capture matched number in $1
>> 		  \d*  	# match zero or more decimal digits
>> 		  [05]	# followed by a '0' or '5'
>> 		)		# end of capture
>> 		(?:		# followed by either:
>> 		  \D 	        # a non-digit
>> 		|		# or
>> 		  $		# the end of the string
>> 		)
>> 		}x
>>=20
>=20
> --=20
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> http://learn.perl.org/
>=20
>=20

Jim Gibson
Jim@Gibson.org
0
Jim
9/8/2019 11:41:31 PM
You are not doing anything with $t to test whether
it works.=C2=A0 Also you are not telling us what data you
might test it with.


Mike


On 9/8/2019 6:41 PM, Jim Gibson wrote:
> On Sep 8, 2019, at 3:39 PM, Mike <temp4@mflan.com> wrote:
>
> I expect it to return a positive value if $t contains a number anywhere=
 within it and put that number in the $1 capture variable.
>
>
>
> On 9/8/2019 4:34 PM, Jim Gibson wrote:
>>> On Sep 8, 2019, at 1:30 PM, Gautam Desai <gautam.satya.desai@gmail.co=
m> wrote:
>>>> Do you guys have any pointers ?
>>> 	$t =3D~ m{
>>> 		(		# capture matched number in $1
>>> 		  \d*  	# match zero or more decimal digits
>>> 		  [05]	# followed by a '0' or '5'
>>> 		)		# end of capture
>>> 		(?:		# followed by either:
>>> 		  \D 	        # a non-digit
>>> 		|		# or
>>> 		  $		# the end of the string
>>> 		)
>>> 		}x
>>>
>> --=20
>> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
>> For additional commands, e-mail: beginners-help@perl.org
>> http://learn.perl.org/
>>
>>
> Jim Gibson
> Jim@Gibson.org
>
0
temp4
9/9/2019 12:54:09 AM
Jim Gibson <Jim@Gibson.org> writes:

> On Sep 8, 2019, at 3:39 PM, Mike <temp4@mflan.com> wrote:
>> 
>> 
>> It's probably best if you write a short script
>> that reads a __DATA__ section of data.
>> Then tell us what it does and what you expected
>> it to do.
>> 
>> Off hand I don't see anything wrong with your regex,
>> but I don't know what you expect it to do.
>> 
>
> I expect it to return a positive value if $t contains a number anywhere within it and put that number in the $1 capture variable.

Well, that is not what is in your regex: you look for a decimal number
ending with 0 or 5, and it must be the last number of the line.

What about something simple like:

    /(\d*[05])\D*$/

The Regex Coach is your friend (and works well under wine).

It alsways help to present with some sample data.

Best regards,

Olivier

>> 
>> Mike
>> 
>> 
>> On 9/8/2019 4:34 PM, Jim Gibson wrote:
>>> On Sep 8, 2019, at 1:30 PM, Gautam Desai <gautam.satya.desai@gmail.com> wrote:
>>>> Do you guys have any pointers ?
>>> 	$t =~ m{
>>> 		(		# capture matched number in $1
>>> 		  \d*  	# match zero or more decimal digits
>>> 		  [05]	# followed by a '0' or '5'
>>> 		)		# end of capture
>>> 		(?:		# followed by either:
>>> 		  \D 	        # a non-digit
>>> 		|		# or
>>> 		  $		# the end of the string
>>> 		)
>>> 		}x
>>> 
>> 
>> -- 
>> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
>> For additional commands, e-mail: beginners-help@perl.org
>> http://learn.perl.org/
>> 
>> 
>
> Jim Gibson
> Jim@Gibson.org

-- 
0
Olivier
9/9/2019 1:36:30 AM

> On Sep 8, 2019, at 6:36 PM, Olivier <Olivier.Nicole@cs.ait.ac.th> =
wrote:
>=20
> Jim Gibson <Jim@Gibson.org> writes:
>=20
>> On Sep 8, 2019, at 3:39 PM, Mike <temp4@mflan.com> wrote:
>>>=20
>>>=20
>>> It's probably best if you write a short script
>>> that reads a __DATA__ section of data.
>>> Then tell us what it does and what you expected
>>> it to do.
>>>=20
>>> Off hand I don't see anything wrong with your regex,
>>> but I don't know what you expect it to do.
>>>=20
>>=20
>> I expect it to return a positive value if $t contains a number =
anywhere within it and put that number in the $1 capture variable.
>=20
> Well, that is not what is in your regex: you look for a decimal number
> ending with 0 or 5, and it must be the last number of the line.
>=20
> What about something simple like:
>=20
>    /(\d*[05])\D*$/

I prefer the explicit (?:=E2=80=A6|=E2=80=A6) structure that tells the =
reader that an alternate expression is being used. Also, the =E2=80=9Czero=
 or more=E2=80=9D * operator can be very slow for long strings.

>=20
> The Regex Coach is your friend (and works well under wine).
>=20
> It alsways help to present with some sample data.

If you want to use this regex, then you should test it yourself. I did.

>=20
> Best regards,
>=20
> Olivier
>=20
>>>=20
>>> Mike
>>>=20
>>>=20
>>> On 9/8/2019 4:34 PM, Jim Gibson wrote:
>>>> On Sep 8, 2019, at 1:30 PM, Gautam Desai =
<gautam.satya.desai@gmail.com> wrote:
>>>>> Do you guys have any pointers ?
>>>> 	$t =3D~ m{
>>>> 		(		# capture matched number in $1
>>>> 		  \d*  	# match zero or more decimal digits
>>>> 		  [05]	# followed by a '0' or '5'
>>>> 		)		# end of capture
>>>> 		(?:		# followed by either:
>>>> 		  \D 	        # a non-digit
>>>> 		|		# or
>>>> 		  $		# the end of the string
>>>> 		)
>>>> 		}x
>>>>=20
>>>=20
>>> --=20
>>> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
>>> For additional commands, e-mail: beginners-help@perl.org
>>> http://learn.perl.org/
>>>=20
>>>=20
>>=20
>> Jim Gibson
>> Jim@Gibson.org
>=20
> --=20
>=20
> --=20
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> http://learn.perl.org/

Jim Gibson
Jim@Gibson.org
0
Jim
9/9/2019 2:58:52 AM
--000000000000e901ba0592208156
Content-Type: text/plain; charset="UTF-8"

Thanks a lot
Gautam S Desai





On Sun, Sep 8, 2019 at 6:39 PM Mike <temp4@mflan.com> wrote:

>
> It's probably best if you write a short script
> that reads a __DATA__ section of data.
> Then tell us what it does and what you expected
> it to do.
>
> Off hand I don't see anything wrong with your regex,
> but I don't know what you expect it to do.
>
>
> Mike
>
>
> On 9/8/2019 4:34 PM, Jim Gibson wrote:
> > On Sep 8, 2019, at 1:30 PM, Gautam Desai <gautam.satya.desai@gmail.com>
> wrote:
> >> Do you guys have any pointers ?
> >       $t =~ m{
> >               (               # capture matched number in $1
> >                 \d*   # match zero or more decimal digits
> >                 [05]  # followed by a '0' or '5'
> >               )               # end of capture
> >               (?:             # followed by either:
> >                 \D            # a non-digit
> >               |               # or
> >                 $             # the end of the string
> >               )
> >               }x
> >
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> http://learn.perl.org/
>
>
>

--000000000000e901ba0592208156
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Thanks a lot=C2=A0<br clear=3D"all"><div><div class=3D"gma=
il_signature" dir=3D"ltr" data-smartmail=3D"gmail_signature"><div dir=3D"lt=
r"><div style=3D"margin:0px;padding:0px 0px 20px;width:872px"><div><div sty=
le=3D"margin:8px 0px 0px;padding:0px"><div><div dir=3D"ltr"><span><font col=
or=3D"#888888"><div style=3D"font-family:Roboto,RobotoDraft,Helvetica,Arial=
,sans-serif;font-size:12.8px" dir=3D"ltr">Gautam S Desai<br></div><div dir=
=3D"ltr"><br><br></div><div style=3D"font-family:Roboto,RobotoDraft,Helveti=
ca,Arial,sans-serif;font-size:12.8px" dir=3D"ltr"><br></div></font></span><=
/div><div style=3D"font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-seri=
f;font-size:12.8px"></div></div></div><div style=3D"font-family:Roboto,Robo=
toDraft,Helvetica,Arial,sans-serif;font-size:medium"></div></div></div></di=
v></div></div><br></div><br><div class=3D"gmail_quote"><div class=3D"gmail_=
attr" dir=3D"ltr">On Sun, Sep 8, 2019 at 6:39 PM Mike &lt;<a href=3D"mailto=
:temp4@mflan.com">temp4@mflan.com</a>&gt; wrote:<br></div><blockquote class=
=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;padding-left:1ex;border-=
left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid">=
<br>
It&#39;s probably best if you write a short script<br>
that reads a __DATA__ section of data.<br>
Then tell us what it does and what you expected<br>
it to do.<br>
<br>
Off hand I don&#39;t see anything wrong with your regex,<br>
but I don&#39;t know what you expect it to do.<br>
<br>
<br>
Mike<br>
<br>
<br>
On 9/8/2019 4:34 PM, Jim Gibson wrote:<br>
&gt; On Sep 8, 2019, at 1:30 PM, Gautam Desai &lt;<a href=3D"mailto:gautam.=
satya.desai@gmail.com" target=3D"_blank">gautam.satya.desai@gmail.com</a>&g=
t; wrote:<br>
&gt;&gt; Do you guys have any pointers ?<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0$t =3D~ m{<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# capture matched number in $1<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\d*=C2=A0=
 =C2=A0# match zero or more decimal digits<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[05]=C2=
=A0 # followed by a &#39;0&#39; or &#39;5&#39;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0)=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# end of capture<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(?:=C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# followed by either:<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\D=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 # a non-digit<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# or<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0$=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# the end of the string<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0)<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}x<br>
&gt;<br>
<br>
-- <br>
To unsubscribe, e-mail: <a href=3D"mailto:beginners-unsubscribe@perl.org" t=
arget=3D"_blank">beginners-unsubscribe@perl.org</a><br>
For additional commands, e-mail: <a href=3D"mailto:beginners-help@perl.org"=
 target=3D"_blank">beginners-help@perl.org</a><br>
<a href=3D"http://learn.perl.org/" target=3D"_blank" rel=3D"noreferrer">htt=
p://learn.perl.org/</a><br>
<br>
<br>
</blockquote></div>

--000000000000e901ba0592208156--
0
gautam
9/9/2019 3:33:09 PM
Reply: