[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
- <!--x-content-type: text/plain -->
- <!--x-date: Thu Mar 11 23:15:16 2004 -->
- <!--x-from-r13: zvxr ng glqrevn.arg ([vxr [hecul) -->
- <!--x-message-id: [email protected] -->
- <!--x-reference: 1079063828.9310.19.camel@devel --> "http://www.w3.org/TR/html4/loose.dtd">
- <!--x-subject: [ale] Regex question -->
- <li><em>date</em>: Thu Mar 11 23:15:16 2004</li>
- <li><em>from</em>: mike at tyderia.net (Mike Murphy)</li>
- <li><em>in-reply-to</em>: <1079063828.9310.19.camel@devel></li>
- <li><em>references</em>: <1079063828.9310.19.camel@devel></li>
- <li><em>subject</em>: [ale] Regex question</li>
=~ /(XMI\d\d\d)/ should work. The entire string matched will show up in
$1 afteward. This presumes that not other characters will show in the
string.
Its also likely that
=~ /(XMI\d+)/ or even /(XMI/d*)/ would work too (the first would match 1
or more 'digits' the second would match 0 or more).
If you don't need to use $1 for anything, you can ditch the parens.
Mike
Chris Fowler wrote:
> I need to do a match using perl regex. Here is the possible strings
> that will be in a stream:
>
> XMI
> XMI001
> XMI002
> XMI###
>
> Were the '#' could be any number. I need to be able to detect that
> the above pattern matches in a chunk of data. What is the correct
> regex that will fit that pattern?
>
> Thanks,
> Chris
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> <a rel="nofollow" href="http://www.ale.org/mailman/listinfo/ale">http://www.ale.org/mailman/listinfo/ale</a>
--
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Mike Murphy
781 Inman Mews Drive Atlanta GA 30307
Landline: 404-653-1070
Mobile: 404-545-6234
Email: mike at tyderia.net
Email Pager: pagemike at tyderia.net
AIM: mmichael453
JDAM: 33:45:14.0584N 84:21:43.038W
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<ul><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><a name="00367" href="msg00367.html">[ale] Regex question</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Christopher Fowler)</li></ul></li>
</ul></li></ul>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="00369" href="msg00369.html">[ale] Regex question</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Chris Fowler)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00369.html">[ale] Regex question</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00367.html">[ale] Regex question</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00369.html">[ale] Regex question</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00367.html">[ale] Regex question</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00366"><strong>Date</strong></a></li>
<li><a href="threads.html#00366"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>
<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>