i want to set RegularExpressions for check string1.
string1 can change to :
- string1:=’D1413578;1038′
- string1:=’D2;11′
- string1:=’D16;01′
- ,….
in string1 only Character ‘D’ and semicolon is always exist.
i set RegularExpressions1 := ‘\b(D#\;#)\b’;
but RegularExpressions1 can’t to check string1 correctly.
in the vb6 this RegularExpressions1=”D#;#”. but i don’t know that is in Delphi??
Try
\d*means “zero or more digits”.By the way, I have omitted the second
\bbecause otherwise the match would fail if there is no number after the semicolon (and you said the number was optional).If by “check” you mean “validate” an entire string, then use
All this assumes that only digits are allowed after
Dand;. If that is not the case, please edit your question to clarify.