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: how to extract consecutive digits of a known length in a string
Replies: 2   Last Post: Nov 13, 2012 12:33 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: how to extract consecutive digits of a known length in a string
Posted: Nov 12, 2012 12:47 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

In article <k7qt7u$t34$>,
"Ha " <> wrote:

> E.g.,
> s = 'xasdf.123456.dkkk';
> s = '342456.xkkd.sdf23.456..dd';
> I wanna get the six successive digits from such strings. I guess regular
> expression can handle this problem but don't know how.


will find six digits in a row, but do you want it to fail if there
happen to be seven? That line will find the first six, but you would
have to do something more elaborate to exclude cases of more than six.

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.