This question already has answers here:
Regex for one or more words separated by spaces
(2 answers)
Closed 2 years ago.
Data
"06/12/20 ,NOVUS HOME MORTGAGE
04/22/20 ,CAP ONE NA
04/22/20 ,CAPITAL ONE
04/22/20 ,CAPITALONE
04/16/20 ,CREDCO
04/16/20 ,CREDCO
04/16/20 ,FLAGSTAR BANK OA R"
Regex : "[A-Z\s]+"
The result I wanted is NOVUS HOME MORTGAGE, CAP ONE NA etc all the data . but it includes space , how not to include space ? it did include the space before , I dont wanna include space
The \s will match any white space character. So removing might solve what you are asking for. (I don't fully understand your question and what you want, so just providing a suggestion)
Related
This question already has answers here:
What do ^ and $ mean in a regular expression?
(2 answers)
Closed 2 years ago.
I know there are similar question asked (might the same question here) but I can't seems to get my regex to work. I tried the answer there but didn't work which is below.
^[A-Z]{2}\d+
I'm trying to check if the country serial or organisation numbers start with specific two capital letters. For example BE0462427110 is from a Belgium company so all the org. numbers should start with BE. German once have DE and Italian once have IT in front.
So I tried below my own version as well.
^([BE]{2})([\d]{6,10})$
Below is a test block I use to extract the numbers from using regex. And the number is after "BEPC0 PARTS".
C0MMUNAUTE EUR0PEENNE 1 ExpCd1teur/Exp0rtateur (2) N0. BEPC0 PARTS
BE0462427110 Rue Chaum0nt(Herm) 4 D F BE 4480 Eng1s E D q 1jj -
Dest1na1re (8) N0, N M BUCHER 1ANDTECHN1K SA 7
After the above regex didn't work I tried another.
^([B][E])([\d]{6,10})$
So what am I doing wrong here ?
This anchors at the beginning and end of the string:
^([A-Z]{2})([\d]{6,10})$
You are looking for a pattern somewhere within a string, so you can anchor by word boundaries \b:
\b([A-Z]{2})([\d]{6,10})\b
This question already has answers here:
How can I match "anything up until this sequence of characters" in a regular expression?
(15 answers)
Closed 3 years ago.
I have strings that are concatenations of airline codes/flightnumbers, separated with ;. The airline code and flight number are either separated by a space or -. So some examples are:
AA-1234;UA 243;EK 23;
9W 23;B6-134
Now I want to grab the airline codes from this.
I came up with the following regex: [a-zA-Z0-9]{2}[ -]. This works to grab the airline codes but also includes the airlinecode-flightnumber separator. How would I adjust my regex to not include this?
[a-zA-Z0-9]{2}(?=[ -])
See it in action here
This question already has answers here:
Notepad++ regex -> newLine
(5 answers)
Closed 3 years ago.
I am looking for a way in Notepad++ to find lines not containing any number and moving it to the previous line after adding a separator like "#"
moon 215466
sun & stars world
the sea 345454
sky # 464654
cars 135456
school teachers
the result i want:
moon 215466#sun & stars world
the sea 345454
sky # 464654
cars 135456#school teachers
I am new to regex so i searched all questions and tried ^[^\d]$ and ^\D$ and /^[^0-9]*$/ it find the lines with no numbers but i can't move it to the previous line.
Thank you
You can try the following:
If you write your text out, it will look something like this:
What you essentially want to do is to remove the CR (carriage return) and LF (line feed) characters if they are followed by a line containing no digits. The regex for a line containing no digits is ^(\D*)$ - please do ask if you need help understanding how it works. We then replace the CR + LF + Regex match with #\1 - # symbol and \1 references the contents of the first capturing group, which means the first set of parentheses in your search regex (line with no digits).
Result:
Maybe this expression,
(?m)(.*?#\s*\d+)\s*(.*?&.*)
with a replacement of
$1#$2
might work, not sure though.
DEMO
Reference
Notepad++ multiline regex
This question already has answers here:
A regex to match a substring that isn't followed by a certain other substring
(5 answers)
Closed 3 years ago.
How to mark xy if the next symbol is not y?
I have four strings:
1. zxyy
2. zxyz
3. zxy
4. xy
The epxression should mark strings 2-4.
This regex marks the 2-nd string only:
([x][y])(?=[^y])
Thanx.
The regex recommended by Aaron works as I wished:
xy(?!y)
It marks 2. zxyz 3. zxy 4. xy, but not 1. zxyy.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I need to limit an accepted text response to be only in the following format:
1234567.123 AorABorABCD (1or12)
So, 7-digits.3-digits 1-4Letters (1-3-digits)
This is a SKU number, followed by 1-4 letters noting size (S or YM or SMMD) followed by 1-3 digits noting quantity needed.
Any help is appreciated -- thanks!
Something like this?
\d{7}\.\d{3}\s[A-Za-z]{1,4}
Explanation:
\d{7} - matches 7 digits
\. matches the dot (".")
\d{3} - again, matches 3 digits
\s - matches a whitespace
[A-Za-z]{1,4} - matches 1-4 letters from A to Z no matter the case.
Will match:
1234567.123 AABd
1534567.113 AaAA
4586451.773 dasA
1231846.123 A
1234567.123 Ao
1234567.123 Aor
1234567.123 AorA
1234567.123 AorA
1234567.123 AorA
Also, if you do not need all letters from A to Z change the range accordingly.
EDIT: Forgot the slash before the dot, mind the changed content.
You can try it here