0

I want 2 regex mathing input string at one time:

<input type="text" pattern="(?=first match of whole string)(?=second match of whole string)" />

In the output I want only the RegEx /^(?=first match of whole string)(?=second match of whole string)$/.

I saw similar post, but there must to be added .* at the end of initial pattern value, - it does not feet for my purpose.

Thanx

Max Ermolaev
  • 41
  • 2
  • 8
  • `pattern="(?=first match of whole string)(?=second match of whole string).*"` will fit your purpose exactly. – Wiktor Stribiżew Jun 08 '18 at 12:45
  • @WiktorStribiżew thanx for answering, the second RegEx I have is `(?=\+([0-9]\s?){7,15})` - it is the length validation at some point (but just for count of numbers in string). And it does not work if I append `.*`, I will still can type more than 15 numbers in string – Max Ermolaev Jun 08 '18 at 12:51
  • 1
    That is not the issue with `.*`. You just missed `$`: `(?=\+([0-9]\s?){7,15}$)` - and then it is still a dupe of [Regex - Match whole string](https://stackoverflow.com/questions/6298566/regex-match-whole-string). – Wiktor Stribiżew Jun 08 '18 at 12:55
  • 1
    @WiktorStribiżew agree – Max Ermolaev Jun 08 '18 at 13:01

0 Answers0