regex match only two group [closed] - regex

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 months ago.
Improve this question
I want to receive in example regex match only 17 and 20 (skip 3 match only two match)

Depending on what you want to do, this one can be a good solution
[0-9]{2}(?!$)
It matches the groups of 2 digits not at the end of a line !
You can also try : ([0-9]{2})\s[A-z]+\s([0-9]{2}) if you want only 2 groups

Related

Regex to select first two characters from string and remove rest of the string [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I want to select first two characters appearing on a given string like below.
in below example i would like the result to show "CJ" only.
";2;14;1;1;CJ;1;CT;1;DG;1;DJ;1;DT;1;QF;1;QG;1;QH;1;TA;1;TG;1;TK;1;TR;1;TW;1;TX";
([a-zA-Z]{2})
(): Capture the string into a group
[a-zA-Z]: Match any letter, upper or lower case
{2}: Match exactly 2 times
Make sure the "global" flag is not enabled ("global" allows returning multiple matches, not just the first)

regex two first letters [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
How do read two first letters and delete line?
This code remove all line where is GG
.*gg.*.*.*
ggang - delete
gangg -undelete
Tested in notepad++:
find: ^(gg.*)$
replace: (leave blank)
in:
ggang
gangg
out:
gangg

Regex: Exact number of symbols and lines [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I would like to use regex in Java to substring text.
The string must be max 140 characters in all ( not counting new line/enter characters) and there might be max 4 lines
I found out how to substring 140 symbols: ^(.|\n|\r){0,140}
My question is how to add limitation for only 4 lines
and exclude new line/enter characters
Thanks for help!
This expression should do what you are looking for:
^([^\r\n]{0,140}(\r?\n|$)){4}
Try it here.

Another RegEx to match wanted result [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm having another issue where I want to extract values from a string. Please take a look.
string anotherTest = "Hello World [A12345 **(05,00,45)**] - [518.6Z] [51.5]"
I would like the result to return "A12345" "518.6Z" "51.5".
What I highlighted in bold is what I'm having issue with.
I'm using c# and I've tried [(\D?\d+.?\d+\D?)] ... which is fine if I don't have what's in parentheses.
You need to extract the first word from a [ ... ] substring. Use groups:
.*?(\[([^\[\] ]+).*?\])*
Then extract second group from all the captures (depending on your langauge)

how to get first word after phrase with regex [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
How do you find the first word after a string literal via regex?
I.e.
I want to extract "DAQJ7PS" from the line:
ERROR service.PostService - Failed to save post DAQJ7PS
/ERROR service\.PostService - Failed to save post (.+)/
will give you the result in the first capturing group. This can be tuned if you have more specific requirements.