How to parse information between two strings using regular expressions?
古いコメントを表示
Hello,
I am trying to parse some information contained between the two strings "<sample>" and "</sample>" . I am new to regular expressions and would like to know what expression suits my requirement. The strings i mentioned have some operators in them. This is making the job difficult.
Regards, Math
2 件のコメント
Guillaume
2014 年 12 月 1 日
If you need more help than Thorsten's answer (which pretty much tells you everything that there is to it), then show us your current regular expression.
採用された回答
その他の回答 (2 件)
help regexp
There it says
Characters that are not special metacharacters are all treated literally in
a match. To match a character that is a special metacharacter, escape that
character with a '\'.
Niels
2014 年 12 月 2 日
Alternatively, you may also consider using regexprep instead of regexp.
>> extract = regexprep(str,pat,'')
extract =
a,b,c
カテゴリ
ヘルプ センター および File Exchange で Characters and Strings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!