Skip to main content
added 75 characters in body
Source Link
abc123
  • 19k
  • 7
  • 55
  • 84

RegexRegex

(www\.((?!www\.).)*)

Regular expression visualization

Debuggex Demo


Description

Options: case insensitive

Match the regular expression below and capture its match into backreference number 1 «(www\.((?!www\.).)*)»
    Match the characters “www” literally «www»
    Match the character “.” literally «\.»
    Match the regular expression below and capture its match into backreference number 2 «((?!www\.).)*»
        Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*»
        Note: You repeated the capturing group itself.  The group will capture only the last iteration.  Put a capturing group around the repeated group to capture all iterations. «*»
        Assert that it is impossible to match the regex below starting at this position (negative lookahead) «(?!www\.)»
        Match the characters “www” literally «www»
        Match the character “.” literally «\.»
    Match any single character that is not a line break character «.»

Java

try {
    String subjectString = "www.google.comwww.yahoo.comwww.ebay.com";
    String[] splitArray = subjectString.split("(?i)(www\\.((?!www\\.).)*)");
} catch (PatternSyntaxException ex) {
    // Syntax error in the regular expression
}

Note: Regex101 example to come

Regex

(www\.((?!www\.).)*)

Description

Options: case insensitive

Match the regular expression below and capture its match into backreference number 1 «(www\.((?!www\.).)*)»
    Match the characters “www” literally «www»
    Match the character “.” literally «\.»
    Match the regular expression below and capture its match into backreference number 2 «((?!www\.).)*»
        Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*»
        Note: You repeated the capturing group itself.  The group will capture only the last iteration.  Put a capturing group around the repeated group to capture all iterations. «*»
        Assert that it is impossible to match the regex below starting at this position (negative lookahead) «(?!www\.)»
        Match the characters “www” literally «www»
        Match the character “.” literally «\.»
    Match any single character that is not a line break character «.»

Java

try {
    String[] splitArray = subjectString.split("(?i)(www\\.((?!www\\.).)*)");
} catch (PatternSyntaxException ex) {
    // Syntax error in the regular expression
}

Note: Regex101 example to come

Regex

(www\.((?!www\.).)*)

Regular expression visualization

Debuggex Demo


Description

Options: case insensitive

Match the regular expression below and capture its match into backreference number 1 «(www\.((?!www\.).)*)»
    Match the characters “www” literally «www»
    Match the character “.” literally «\.»
    Match the regular expression below and capture its match into backreference number 2 «((?!www\.).)*»
        Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*»
        Note: You repeated the capturing group itself.  The group will capture only the last iteration.  Put a capturing group around the repeated group to capture all iterations. «*»
        Assert that it is impossible to match the regex below starting at this position (negative lookahead) «(?!www\.)»
        Match the characters “www” literally «www»
        Match the character “.” literally «\.»
    Match any single character that is not a line break character «.»

Java

try {
    String subjectString = "www.google.comwww.yahoo.comwww.ebay.com";
    String[] splitArray = subjectString.split("(?i)(www\\.((?!www\\.).)*)");
} catch (PatternSyntaxException ex) {
    // Syntax error in the regular expression
}
Source Link
abc123
  • 19k
  • 7
  • 55
  • 84

Regex

(www\.((?!www\.).)*)

Description

Options: case insensitive

Match the regular expression below and capture its match into backreference number 1 «(www\.((?!www\.).)*)»
    Match the characters “www” literally «www»
    Match the character “.” literally «\.»
    Match the regular expression below and capture its match into backreference number 2 «((?!www\.).)*»
        Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*»
        Note: You repeated the capturing group itself.  The group will capture only the last iteration.  Put a capturing group around the repeated group to capture all iterations. «*»
        Assert that it is impossible to match the regex below starting at this position (negative lookahead) «(?!www\.)»
        Match the characters “www” literally «www»
        Match the character “.” literally «\.»
    Match any single character that is not a line break character «.»

Java

try {
    String[] splitArray = subjectString.split("(?i)(www\\.((?!www\\.).)*)");
} catch (PatternSyntaxException ex) {
    // Syntax error in the regular expression
}

Note: Regex101 example to come