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

how to extract the string using regular expressions

$
0
0

I have the list :

a1 = {"struct name1 {","struct name2{","struct name3{","struct name4{","struct name5{","struct lastStruct{"}

I tried to extract the struct names "name1",..."lastStruct" with this but I failed hard :(

StringCases[a1, RegularExpression["[^struct^{^\\s]"]]

Which returned:

{{"n", "a", "m", "e", "1"}, {"n", "a", "m", "e", "2"}, {"n", "a", "m", "e", "3"}, {"n", "a", "m", "e", "4"}, {"n", "a", "m", "e", "5"}, {"l", "a", "S"}}

Any ideas?


Viewing all articles
Browse latest Browse all 188

Trending Articles



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