Reputation: 4951
Im trying to strip off one word from line my backend is java
I did the following. Example line:
TICKET0041960 Fix code at css
I want to strip off TICKET0041960
so the result will be
Fix code at css
I used this
TICKET[.0-9]
and I ended up with result as
041960 Fix code at css
Any tips to adjust regex to strip off TICKET0041960 consider numbers always random
Upvotes: 2
Views: 65
Reputation: 48837
TICKET[.0-9]
means the string TICKET followed by either a dot or a digit between 0 and 9.
What you actually need is TICKET[0-9]+
: the string TICKET followed by one or more digits between 0 and 9.
[0-9]
can be simplified to \d
(i.e. TICKET\d+
), but don't forget to escape the backslash in Java since in a string literal (i.e. TICKET\\d+
).
You may want to remove the leading space(s) as well: TICKET\d+\s+
(again, TICKET\\d+\\s+
for Java).
Upvotes: 4