Regular Expressions 101

@regex101
Donate
Sponsor
Contact
Bug Reports & Feedback
Wiki
Whats new?

Save & Share

  • Save Regex
    ctrl+s
  • Update Regex
    ctrl+⇧+s

Flavor

  • PCRE2 (PHP >=7.3)
  • PCRE (PHP <7.3)
  • ECMAScript (JavaScript)
  • Python 2.7
  • Golang
  • Java 8

Function

  • Match
  • Substitution
  • List
  • Unit Tests
/
^(?=.[[:alpha:]].)([[:alpha:]](\d([.,]\d)?)?[[:alpha:]])*$
/
gimu
^ asserts position at start of a line
Positive Lookahead
(?=.[[:alpha:]].)
Assert that the Regex below matches
.
matches any character, including unicode (except for line terminators)
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
Match a single character present in the list below
[[:alpha:]]
[:alpha:] matches a alphabetic character \p{L}
.
matches any character, including unicode (except for line terminators)
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
1st Capturing Group
([[:alpha:]](\d([.,]\d)?)?[[:alpha:]])*
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
A repeated capturing group will only capture the last iteration. Put a capturing group around the repeated group to capture all iterations or use a non-capturing group instead if you're not interested in the data
Match a single character present in the list below
[[:alpha:]]
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
[:alpha:] matches a alphabetic character \p{L}
2nd Capturing Group
(\d([.,]\d)?)?
? matches the previous token between zero and one times, as many times as possible, giving back as needed (greedy)
\d
matches a digit zero through nine in any script except ideographic scripts (equivalent to \p{Nd})
3rd Capturing Group
([.,]\d)?
Match a single character present in the list below
[[:alpha:]]
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
[:alpha:] matches a alphabetic character \p{L}
$ asserts position at the end of a line
Global pattern flags
g modifier: global. All matches (don't return after first match)
i modifier: insensitive. Case insensitive match (ignores case of [a-zA-Z])
m modifier: multi line. Causes ^ and $ to match the begin/end of each line (not only begin/end of string)
u modifier: unicode. Pattern strings are treated as UTF-16. Also causes escape sequences to match unicode characters
Your regular expression does not match the subject string.Try launching the debugger to find out why.

Regular Expression
No Match

/
/
gimu

Test String