フィルターのクリア

Another regexp parsing question

1 回表示 (過去 30 日間)
Duke
Duke 2014 年 3 月 15 日
回答済み: per isakson 2014 年 3 月 15 日
I have a string with 2 hex values like:
'.text 0x54a65b23 0x45 (hello)'
I want to pull the full hex numbers out of this string. Like my last question I just can't get it right. I can get the '0x' part of each number but I can't get the full string. I tried a lot of different varitions of this '0x[1234567890abcdef]'. I've tried doing '+' and '*' after each character but it refuses to get the numbers after the 0x. Thanks!

採用された回答

per isakson
per isakson 2014 年 3 月 15 日
The "+" should be after "]"
str = '.text 0x54a65b23 0x45 (hello)';
cac = regexp( str, '0x[0-9a-fA-F]+', 'match' )
returns
cac =
'0x54a65b23' '0x45'

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeString Parsing についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by