Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Question Using Regexpi
Replies: 11   Last Post: Jul 8, 2013 10:35 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
dpb

Posts: 8,137
Registered: 6/7/07
Re: Question Using Regexpi
Posted: Jul 3, 2013 1:52 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 7/3/2013 12:20 PM, Doug Schwarz wrote:
...

> Your idea is sound, but you have the RE wrong. The beginning of a word
> anchor is '\<', not'<\'. Also, to match 1 or more contiguous digits
> use '\d+'. So the final expression is '\<\d+\>' which does what you
> want.
>


Thanks, Doug...I stared at and even thought I pasted from the regexp doc
the form and still couldn't see had the \< reversed. I wasn't aware of
(and didn't see in looking thru the voluminous doc altho I'm sure it's
there if know where to look) the '+' though--would have thought the word
expression would be sufficient.

>> regexp(String,'\<\d+\>','match')
ans =
'61'
>>

And, by golly! it does... :) Now just how easy was that! :)

I've never had the patience nor enough occasion where was forced to
learn the syntax well enough that it isn't always starting over from
near absolute zero every time it might be useful... :) (or :( more
appropriately, maybe...)

--




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.