- 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
조회 수: 13 (최근 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!