Very long pattern
-
@PeterJones said in Very long pattern:
(\d*[5-9]|\d+[01])\b
Thanks
Works very well.
The greater the range, the better.
This one works up to a thousand and such a pattern is enough for meMissing only:
12, 14, 112, 114 -
[10-21] [110-121] is not a formula, but a range of numbers
from 10 to 21 and from 110 to 121Missing only:
12, 14, 112, 114, 212, 214, 312, 314 e.t.c. -
Missing only:
12, 13, 14, 112, 113, 114, 212, 213, 214, 312, 313, 314 e.t.c. -
I am assuming that these are just clarifying your simplification of your problem statement, and that you still have the solution you need. If this is not the case, please clarify, giving examples of numbers that are not properly matching.
----
Do you want regex search/replace help? Then please be patient and polite, show some effort, and be willing to learn; answer questions and requests for clarification that are made of you. All example text should be marked as plain text using the
</>
toolbar button or manual Markdown syntax. Screenshots can be pasted from the clipbpard to your post usingCtrl+V
to show graphical items, but any text should be included as literal text in your post so we can easily copy/paste your data. Show the data you have and the text you want to get from that data; include examples of things that should match and be transformed, and things that don’t match and should be left alone; show edge cases and make sure you examples are as varied as your real data. Show the regex you already tried, and why you thought it should work; tell us what’s wrong with what you do get… Read the official NPP Searching / Regex docs and the forum’s Regular Expression FAQ. If you follow these guidelines, you’re much more likely to get helpful replies that solve your problem in the shortest number of tries. -
This post is deleted! -
So I will write again.
Missing | does not find | do not appear
these numbers
12, 13, 14, 112, 113, 114, 212, 213, 214, 312, 313, 314 e.t.c.
-
Hi @Olivier-Thomas, @PeterJones :
Then try this one instead —just adding a clause to @PeterJones’ expression—:
Find:
((\d*[5-9]|\d+[01])\b)|([1-9]?1[2-4]\b)
Seems to match all the required numbers.
Have fun!
-
@astrosofista , thanks for that. In the 50 invalid character classes in the original group, I didn’t notice that 10-21 was different than all the other groups.
I would simplify yours
(\d*[5-9]|\d+[01]|\d*1[2-4])\b
You seem to be pasting a screenshot from some tool other than Notepad++. I don’t recognize it as coming from any Notepad++ plugin I’ve seen before: is it a Notepad++ plugin?
For your information, this forum is for Notepad++, NOT a generic regex help forum. If you abuse this forum as a generic “make regexes for me, no matter what tool I use”, you will quickly wear out your welcome here. If all you ever talk about is asking for us to make regexes for you, you will wear out your welcome here. This behavior is similar to the behavior condemned in the user @Thomas-2020 / @Pan-Jan , whose thread you recently replied to; learn the lesson from that user and don’t behave like him. (If your behavior starts looking like that user, we will assume you are the same user with a third account, respond accordingly.)
If you are here to talk about Notepad++, great. If not, you might want to find a generic regex help forum.
-
from ## to ##
[2-4] [22-24] [32-34] [42-44] [52-54] … [92-94] [102-104] [122-124] [132-134] … [202-204] [222-224] [232-234] …I made such a pattern
(\d*[2-9]|(\d+0)*)[2-4]
what would you improve on this? -
If it works for you, use it. We have given you enough that you can accomplish this task.
We have pointed you to the official regex documentation for Notepad++, and the FAQ in this forum gives lots of other sites that have other regex help.
You seem to have enough regex experience to be able to delve into other regex syntax yourself.
This is not a generic regex help desk. And this is especially not a we-write-all-your-regex-for-you forum.
-
Do you read what you write or do you think about it for a moment?
For your information, this forum is for Notepad++, NOT a generic regex help forum.Is it prohibited to use Notepad to search for numbers in the text?
You don’t answer the questions yourself.what would you improve on this?
-
Oh, boy…here we go…
-
You are behaving exactly like @Pan-Jan (PJ) and @Thomas-2020 (T2) , and I am working from the assumption that you are, in fact, that individual.
Is it prohibited to use Notepad to search for numbers in the text?
No. But it’s rude to not try things yourself, first. And it’s rude to abuse this forum to make us do your work for you.
You don’t answer the questions yourself.
Stop lying. I have given you and PJ and T2 so many answers it’s ridiculous.
what would you improve on this?
If it worked for me, I would do nothing to improve on it. If it didn’t work for me, I would debug it until it did.
As with PJ and T2, I will not answer any more questions from @Olivier-Thomas until such time as he proves that he is willing to be a contributing , cooperative, non-demanding member of the community rather than an annoying vampire
-
But it’s rude to not try things yourself, first
Where do you get that confidence?I wrote the pattern.
I asked what would you change?
You did not answer.Here nobody asked you and you corrected the pattern.
@astrosofista , thanks for that. In the 50 invalid character classes in the original group,
I didn’t notice that 10-21 was different than all the other groups.I would simplify yours
(\d*[5-9]|\d+[01]|\d*1[2-4])\b*
I don’t think you like people outside your clan.
-
@Olivier-Thomas said in Very long pattern:
I asked what would you change?
You did not answer.The first time you asked, I told you to use what you had if it worked. The second time, I told you I would not change anything. I did answer.
Here nobody asked you and you corrected the pattern.
I didn’t correct it. I simplified it. As part of the flow of conversation. And I am sure @astrosofista was not upset that I did so. And if I did upset him, he is quite capable of letting me know.
I don’t think you like people outside your clan.
Wow! Ad hominem attacks are frowned upon (and usually forbidden) in every forum I’ve been a part of.
What I don’t like is behavior like yours or T2 or PJ, who come here, ask us to write their regexes for them, then change the rules and ask us to rewrite them, and keep doing that, and who treat this forum like their personal regex writing tool.
If the regex works for you, use it. If it doesn’t, debug it. If you have questions that are specific to Notepad++'s implementation, ask away. If you want generic regex help, find a regex forum (this isn’t it).
-
@PeterJones said in Very long pattern:
vampire
Why are you provoking?
Do you want to show I’m a vampire or a troll?
You sit in the virtual world too much (possibly playing) and start to lose touch with the real world.
I am not a priest, but I believe people should be brothers, not enemies.
Think about it before it’s too late. -
I am sorry I overreacted; I am sorry if I offended, though that was not my intention. I did my best to provide answers to your questions as long as I thought they were still relevant to Notepad++. When you posted a screenshot of a tool that didn’t appear to be Notepad++, I called you out on it, because we aren’t here for generic regex questions.
We recently had another user who was asking regex questions, and then complaining that those didn’t work in some non-Notepad++ tool and demanding that we re-write them in alternate syntax that would work in the non-Notepad++ tool. I was getting the impression that you were trying to do the same, so my frustration came through. For that, I am sorry.
Back to our regularly-scheduled Notepad++ discussion.
-
@PeterJones said in Very long pattern:
I didn’t correct it. I simplified it. As part of the flow of conversation. And I am sure @astrosofista was not upset that I did so. And if I did upset him, he is quite capable of letting me know.
Hi @PeterJones,
Of course, I’m not upset at all, even I upvoted your contribution, which as mine I think it was a collaborative effort to improve the responses that each one, individually, can offer.
Have fun!
-
@astrosofista said in Very long pattern:
even I upvoted your contribution
I wish he had done it for me even though I asked him about it.
he just wrote like this:
If it works for you, use it. We have given you enough that you can accomplish this task.((\d*[5-9]|\d+[01])\b)|([1-9]?1[2-4]\b)
Was it not working?@PeterJones
Maybe we’ll bury the war ax and smoke the peace pipe?If you have any questions, I will be happy to answer.