Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: Get a known substring from a string

by Laurent_R (Canon)
on Sep 09, 2016 at 20:52 UTC ( #1171484=note: print w/replies, xml ) Need Help??

in reply to Get a known substring from a string

I feel like I should make clear that I don't know where abouts in the string it will be, I just know that it is in there somewhere.
If you know the content of the sub-string literally in advance and know that it is there, then why would you want to look for it? Well, it you want to check that it is really there, or want to know where in the string it is, then maybe you want to try the index (or, possibly but less likely, the rindex) function. But I suspect that's not really what you want.

The problem, though, it that you did not state what you want. I would suspect you probably want to use a regex to find a sub-string that you don't know exactly in advance, but that matches certain criteria or pattern. If this is the case, please provide more information about what you know about that sub-string.

  • Comment on Re: Get a known substring from a string

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1171484]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2023-03-27 07:49 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (63 votes). Check out past polls.