フィルターのクリア

How to use effectively use the lazy quantifier for regular expression?

2 ビュー (過去 30 日間)
Serbring
Serbring 2021 年 6 月 29 日
コメント済み: Serbring 2021 年 6 月 30 日
Hi all,
I need to to set up a regular expression that stops at the first istance of the expression. To this goal, I am trying to use the lazy quantifier, unfortunately, with no success.
The input is '4223594459854' and the disidered output is {'4223594' '459854'}
Below you will find my code:
regexp('4223594459854','4.*4*?','match')
ans =
'4223594459854'
Which it does not stop at the first 4. How can I solve this issue?
Thank you so much.
Best regards.

採用された回答

Stephen23
Stephen23 2021 年 6 月 30 日
regexp('4223594459854','4.*?4','match')
ans = 1×2 cell array
{'4223594'} {'459854'}

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by