Regex not operator
Posted
by Erik Goens
on Stack Overflow
See other posts from Stack Overflow
or by Erik Goens
Published on 2010-06-02T19:59:11Z
Indexed on
2010/06/02
20:04 UTC
Read the original article
Hit count: 504
JavaScript
|regex
I need to use a regex to pull a value out a url domain that will exclude everything but the host (ex: wordpress) and domain type (ex .com). The urls are dynamic and contain 2-3 values for each result (www.example.com or example.org). I am trying to use this expression, but I am only getting back the first letter of every item I am attempting to exclude:
Expresssion
(?!wordpress|com|www)(\w+|\d+)
String
example.wordpress.com
Results
- example
- ordpress
- om
- Desired Result
example
Any assistance would be greatly appreciated
© Stack Overflow or respective owner