Search pattern in string using wildcard in Delphi?

后端 未结 3 2200
攒了一身酷
攒了一身酷 2021-02-15 15:34

I used to use HYPERSTR library for string processing routine. Now I use newer Delphi. I need to search a pattern in a string, for example the old function is function IsMa

3条回答
  •  遇见更好的自我
    2021-02-15 16:09

    if ? represent a single character:

      if TRegEx.IsMatch('abcdef', 'abcd.f') then
        showmessage('match');
    

    if ? represent any sting:

      if TRegEx.IsMatch('abcdef', 'abcd.*f') then
        showmessage('match');
    

    Don't have XE so haven't tested.

提交回复
热议问题