Quantcast
Channel: Active questions tagged string-manipulation - Mathematica Stack Exchange
Viewing all articles
Browse latest Browse all 186

How to express the notion of "from "a" to the nearest "z"" with patterns?

$
0
0

If I compute this:

 StringCases["abczabvncz", "a" ~~ __ ~~ "z"]

It yields:

{"abczabvncz"}

But I wanted it to take string from "a" to the nearest "z" like:

{"abcz","abvncz"}

I tried to use Repeated[p,n] but the trouble for me is that in the text I'm applying this, there is no guarantee of minimum of maximum between "a" and "z". I would have to use some notion of "nearest z".


Viewing all articles
Browse latest Browse all 186

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>