Nul characters and wildcards in regexp

조회 수: 2 (최근 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 CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by