The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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 ]
Doug Schwarz

Posts: 1,412
Registered: 12/7/04
Re: Question Using Regexpi
Posted: Jul 3, 2013 1:20 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

In article <kr1ime$b3c$>, dpb <> wrote:

> On 7/3/2013 10:32 AM, dpb wrote:
> ...

> > I'm no regexp user but '$' doesn't return the last occurrence of a match
> > in a strung but the match _followed_immediately_ by the \n sequence.
> >
> > You need a search from the end to then find the first full word that is
> > numeric it would appear. I don't know enough regexp otomh to do it on
> > the fly, sorry...but as you've discovered '$' isn't that.

> One would think that
> regexp(String,'<\\d\>','match')
> would find a word containing only digits but it doesn't succeed,
> either... :(

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

Doug Schwarz
Make obvious changes to get real email address.

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

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.