フィルターのクリア

Nul characters and wildcards in regexp

1 回表示 (過去 30 日間)
Brig
Brig 2015 年 3 月 23 日
回答済み: Tijs Van Oevelen 2016 年 5 月 10 日
It seems to be the case that when a regular expression encounters the pattern
[0 46 0]
it always matches everything after it.
Is this a side effect explainable in any way, or just a bug?
Example:
K>> regexp(char([0 0 1 0 41 41 41 41 41 41]),char([0 '.' 0 40 40 40 40]))
ans =
2
The expected answer would be [] because 41 should not match the 40 in the pattern.
  1 件のコメント
per isakson
per isakson 2015 年 3 月 23 日
編集済み: per isakson 2015 年 3 月 23 日
I call it a bug. Why not report it to tech-support whether it is a real problem to your projekt or not.

サインインしてコメントする。

回答 (1 件)

Tijs Van Oevelen
Tijs Van Oevelen 2016 年 5 月 10 日
Hi,
this bug is probably already fixed. I tested your example in several versions of Matlab:
  • in R2013b:
>> regexp(char([0 0 1 0 41 41 41 41 41 41]),char([0 '.' 0 40 40 40 40]))
ans =
2
  • in R2015a:
>> regexp(char([0 0 1 0 41 41 41 41 41 41]),char([0 '.' 0 40 40 40 40]))
ans =
2
  • in R2016a:
>> regexp(char([0 0 1 0 41 41 41 41 41 41]),char([0 '.' 0 40 40 40 40]))
ans =
[]

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by