Reputation: 2898
I'm looking find a string of unknown length that beings with abc.
The strings end is defined by a space, the end of a line, the end of the file, etc.
The string may contain .
characters in the middle.
Examples of what I'm trying to find include:
abc.hello.1.test.a
abc.1test.hello.b.maybe
abc.myTest.1.test.maybe
Characters after the first dot must be present, so the following would not match.
abc.
abc
Upvotes: 1
Views: 2494
Reputation: 940
If you really just want abc.{any non empty string}
its trivial to do ^abc\..+$
which just finds abc.
at the beginning, and then matches 1 or more of anything after that
If you want abc.{any string without a space}
its similar, ^abc\.[^ ]+$
the ^
and $
are called anchors, and make sure your regex is matching the whole string, instead of say, efg.abc.hij
Upvotes: 1
Reputation: 7948
Use this Pattern (abc\.\S+)
Demo
( # Capturing Group (1)
abc # "abc"
\. # "."
\S # <not a whitespace character>
+ # (one or more)(greedy)
) # End of Capturing Group (1)
Upvotes: 2