fixed the issue. Will look into that further idk if that first long space is a tab or multiple blanks so this will work either way assuming the captured string doesn't contain any backreference metacharacters (e.g. &)::
Does that help Matching is not the same thing as capturing. (?:\d) simply means match a subpattern containing \d, but don't bother putting it in a capture group. Your entire pattern (?:\d)\w looks for a (?:\d) followed by a \w; it's functionally equivalent to \d\w. If you're trying to match a \w only when it is preceded by a \d, use a lookbehind assertion instead:
seems to work fine So you've got two problems to solve: first, you want to match ".mysite.com" but not capture it; second, you want to grab up to 10 alphabetic characters in the "subdomain" position. First problem can be solved by using a capturing group. The regex
noncapturing group explanation within a positive lookahead
wish help you to fix your issue grep -P forces grep to use the Perl regexp engine. egrep is the same as grep -E and it forces grep to use the ERE (extended regular expression) engine, that does not support lookahead.