Invalid option for regexpi: (unit8|unit16).

Hi everyone,
does anyone know what this error means:
Error using regexpi
Invalid option for regexpi: (unit8|unit16).
Thanks in advanced!

5 件のコメント

Stephen23
Stephen23 2021 年 3 月 22 日
@Blanca R: please show us how you are calling REGEXPI.
Are you using Simulink by any chance?
Blanca R.
Blanca R. 2021 年 3 月 22 日
編集済み: Blanca R. 2021 年 3 月 22 日
Hi Stephen,
I am not allowed to share the code. But how it calls regexpi should not be a problem, as it has worked fine before. I did changes in the files the code uses, so the problem has to be there.
Yes, I am using Simulink. The release I am using is 18b.
Rik
Rik 2021 年 3 月 22 日
Are you providing the input to regexpi as char or string, or as uint8 or uint16?
You also wrote unit, where it looks like you should mean uint. Can you confirm this is a typo?
You should also be aware that not being able to see the code will limit our options in helping you. In general it should be possible to make a MWE so we can run your code without any other dependencies and can reproduce your issue.
Blanca R.
Blanca R. 2021 年 3 月 22 日
That is not a typo, I did copy&paste of the error in the Command Window.
I've looked for a typo in all my files where I could have written "unit" instead of "uint" and I found nothing.
Rik
Rik 2021 年 3 月 22 日
Well, in that case I can't help you unless you provide more details about how you call regexpi.

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

回答 (1 件)

Arun
Arun 2024 年 2 月 16 日

0 投票

Hey Blanca,
I understand that you need an explanation regarding the error “Error using regexpi Invalid option for regexpi.
regexpi” function is used for matching case insensitive regular expression. The error message suggests that (unit8|unit16) is included as an option or outkey, which is an invalid option resulting in the error.
Here is a sample code for reference that reproduces the same error:
try
str = 'Sample text to search';
pattern = 'text';
regexpi(str, pattern, '(unit8|unit16)');
catch ME
disp(ME.message);
end
Invalid option for regexpi: (unit8|unit16).
Alternatively, refer the below sample code, here the “match” variable will contain the starting indices of any matches found for ‘unit8’ or ‘unit16’ regardless of case within “target_string”:
% Assuming you want to match 'unit8' or 'unit16' in a case-insensitive manner
target_string = 'This is an example string with unit8 and UNIT16.';
expression = '(unit8|unit16)';
matches = regexpi(target_string, expression)
matches = 1×2
32 42
Make sure that any options and outkey that pass to “regexpi” are valid. Some common options include “start, “end”,tokenExtents”, “match”, tokens, “names”, and “split”.
For more information related to “regexpi” please refer the MATLAB documentations link: https://www.mathworks.com/help/matlab/ref/regexpi.html
I hope this helps.

カテゴリ

ヘルプ センター および File ExchangeCharacters and Strings についてさらに検索

タグ

質問済み:

2021 年 3 月 22 日

回答済み:

2024 年 2 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by