- What has tag_id= to do with the question?
- raw="square format" tag_id= is that a sample string of text, out of which you want to extract square format?
Parsing everything between quotation using regular expression
18 次查看(过去 30 天)
显示 更早的评论
I m working on a code that parse whatever occur between the quations as shown in my example below
raw="square format" tag_id=
I want parse only between the quotations (highlighted in bold) "whateverhere even space or dots" parse me
your help is highly appreciated
2 个评论
per isakson
2014-2-7
Walter Roberson
2014-2-7
You say "whateverhere even spaces or dots". Does that include the possibility of double-quotes ?
采纳的回答
Ken Atwell
2014-2-7
I think you want:
raw='"square format" tag_id='
regexp(raw, '"(.*?)"', 'tokens')
That gives you a cell array of all text found within double quotes, and nothing else. KEN
5 个评论
Guillaume
2019-3-21
sst, please start a fresh question rather than commenting on a 5 year old answer.
Walter Roberson
2019-3-21
regexp(raw, '"(.*?)(?<!\\)"', 'tokens')
You might want to add the 'once' option if you only expect one occurance.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!