Retrieving 6 numbers from the text, which are separated by a space, using the regular expression d +, you get not an integer number, but each digit is separated by a comma. Example: "3 5 77 32" after using the expression d +, I get "3, 5, 7, 7, 3, 2". Please tell me the regular expression to get rid of the spaces and get an integer number without commas. Thank.
1 answer
This may be the case if the regularizer engine uses "non greedy mode" (non greedy mode). But how to turn it off (although by default all known engines use just greedy) - you already need to watch a specific implementation.
The second possible reason is that between the numbers there is actually an invisible space (or another similar character).
In any case, write the language and environment, as well as the exact sample code, as you use.
- That is, you need to turn on the greedy mode? - Denis
- Yes, in this case, the plus will take to the maximum. - KoVadim
- Thanks, I'll try. - Denis
- It does not work ... - Denis
- Show the code. Otherwise, you will not help. - KoVadim
|
d*can? Or did not help? - pavel\d+should work exactly. can you show your code? Look here regex101.com/r/rFXM2D/1 - Raz Galstyan\d+a\d. - Raz Galstyans.replace(/\D+/g, '')? What is a programming language? - Wiktor Stribiżew