CSV regex with any digit [closed] - regex

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 8 years ago.
Improve this question
I am trying to looking for regex which allows any comma separated values. Like this.
23,23,23
233-2-3,23,23
23/23/2333,22-22-2222,23
I have tried couple of things but nothing fits 100%.
[^,;]+
/(?!,)(?:(?:,|^)([-+]?(?:\d*\.)?\d+))*$/
(\d+, ?)+(\d+)?
My use case is , if my string pass through above regex, I will parse all the values and store it into an array. If string doesn't have any single , than leave that string.
thanks

As stated in the comments, we have come to the following solution:
(?m)^(?:\d+[\/,-]){2,}\d+$
Explanation:
(?m) : make ^ and $ match start and end of line respectively.
^ : Start of line
(?: : Ignore group
\d+ : Match a digit 1 or more times
[\/,-] : Followed by a / or , or -
) : Closing parenthesis for the ignore group
{2,} : Match two times or more
\d+ : Match a digit 1 or more times
$ : End of line
Online demo

Related

Regex for italian tags [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 2 years ago.
Improve this question
I'm working on a regex to take #users
In italian, sometime there is something like l'#Orazio.
I can't find the right way to take this.
I'm using this line /(?<=^|\s)(#(\S+))/
this is my online tester
https://regex101.com/r/s5BTm0/12
as you can see I have an issue with the case 4
Any tips?
You may use
(?<!\S)(?:\w+['’])?#(\S+)
(?<!\w)(?:\w+['’])?#(\S+)
See the regex demo
Details
(?<!\S) - whitespace or start of string must appear immediately to the left of the current location
(?<!\w) - a location the is not immediately preceded with a word char
(?:\w+['’])? - an optinal sequence of 1+ word chars and then ' or ’
# - a # char
(\S+) - Capturing group 1: one or more non-whitespace chars.
Use an optional group:
(?<=^|\s)(?:\w?'?)(#(\S+))
https://regex101.com/r/s5BTm0/5
For more than 1 letter in front, use:
(?<=^|\s)(?:(\w*')?)(#(\S+))
https://regex101.com/r/s5BTm0/8
And to match all your updated cases:
https://regex101.com/r/s5BTm0/10
For different types of apostrophes:
(?<=^|\s)(?:(\w*['´])?)(#(\S+))
https://regex101.com/r/s5BTm0/13

Find numeric groups from alphanumeric string following pattern +[0..9] [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 3 years ago.
Improve this question
I have a string with alphanumerical characters like this:
hajshajs12 +1212121 12 1AAsdsd 5665789 +987 ++789 aBcD
Can I extract only the numeric characters with length >= 4 starting with + or without + using regex ?
So in the end I should have +1212121 5665789 +987 ++789
You can use this regex
([+](?:[+]\d{2,}|\d{3,})|\d{4,})\b
Regex Breakdown
( #Capturing group
[+] #Match + sign
(?: #Non-capturing group
[+]\d{2,} #Match another + followed by at least 2 digits
| #Alterantion (OR)
\d{3,} #Match at least 3 digits
)
| #Alterantion (OR)
\d{4,} #Match at least 4 digits
)
\b #Word boundary. Number shouldn't be in between alphabets

Using captured groups in Regex [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 5 years ago.
Improve this question
I want to match a string where there are 5 characters where first four characters are A-Z and 5th is a digit. Also the first and the fourth character should be same.
I have a regex: [A-Z]{4}\d
However this wont check if 1st and 4th character are same. Please help
Regex: ^([A-Z])[A-Z]{2}\1\d$
1. ^ start of string.
2. ([A-Z]) capture first character.
3. [A-Z]{2} match next two character which can be in A-Z
4. \1 using captured group which contains first character of string.
5. \d a digit which can be 0-9
6. $ for end of string.
Regex demo

Regex for numbers and a dash [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 6 years ago.
Improve this question
Im looking for a regular expression for a textbox thats accepts either 10 digits, or 8 digits, followed by a dash, followed by 2 digits. Examples:
1212345678
or
12345678-91
If you just want to check if the input is valid without matching any content, this one should be enough:
^\d{8}-?\d\d$
Beginning with 8 digits, followed (or not) by an optional dash, and another 2 digits up to the end.
This Should Work.
((?:^[0-9]{10})|(?:^[0-9]{8}(?:\-\d{2})*))$
Input:
1212345678
12345678-91
12345678901112-10
1234567890-12
Output:
1212345678
12345678-91
See: https://regex101.com/r/AzbVXt/2
^\d{8}(\d{2})?(-\d{2})?$
^ and $ : match from the begging to the end
\d{8} : 8 digits
(\d{2})? : optional two other digits
(-\d{2})? : optional dash, with two other digits
This will match
1212345678
121234567800
Not 1212345678001
1212345678-
1212345678-00
Not 1212345678-001

Which RegEx expression to find in notepad++? [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 6 years ago.
Improve this question
I have in Notepad++ plenty of datetime texts like:
'20160310 17:59:00'
And I want to add '-' character to separate numbers in the date like
'2016-03-10 17:59:00'
How I would be a RegEx expression to do that?
The following regex expression:
('\d{4})(\d{2})(\d{2} \d{2}:\d{2}:\d{2}')
Combined with the following replace expression:
$1-$2-$3
will achieve what you want.
Explanation:
('\d{4}) capture group 1: an apostrophe followed by 4 digits
(\d{2}) capture group 2: 2 digits
(\d{2} \d{2}:\d{2}:\d{2}') capture group 3: 2 digits, a space, 2 digits, a colon, 2 digits, a colon and 2 digits, followed by an apostrophe
$1-$2-$3 - capture group 1, followed by a -, followed by capture group 2, followed by a -, followed by capture group 3