Why does using the RegEx /(?<=]),(?=(L|M|J|V))/gi with the JS split method give me this result?

The title explains my problem. I don’t understand why using the RegEx /(?<=]),(L|M|J|V)/gi with the JS split() method on a string gives me an unexpected result. Using said RegEx results in: [ ‘Lunes[9:00-13:00,14:00-16:00]’, ‘M’, ‘Martes[19:00-3:00]’, ‘M’, ‘Miercoles[19:00-21:00,0:00-3:30]’, ‘J’, ‘Jueves[6:00-8:00,8:30-10:30,16:00-20:05]’ ] instead of: [ ‘Lunes[9:00-13:00,14:00-16:00]’, ‘Martes[19:00-3:00]’, ‘Miercoles[19:00-21:00,0:00-3:30]’, ‘Jueves[6:00-8:00,8:30-10:30,16:00-20:05]’ ] My code: const pattern = /(?<=]),(?=(l|m|j|v))/gi; const… Read More Why does using the RegEx /(?<=]),(?=(L|M|J|V))/gi with the JS split method give me this result?

Regex expression to get the string between two strings,or until either end of the main string

I am trying to write a regex that gets the content between two strings, String1 and String2 but in case either of the two strings are not present I want to match until the end of the main string. For example: hi_foo123xyz2-3bar_hello, foo123xyz2-3bar , foo123xyz2-3 123xyz2-3bar and 123xyz2-3 the intended match is 123xyz2-3. I tried… Read More Regex expression to get the string between two strings,or until either end of the main string

How to add a whitespace before "((VERB)" only if it is not preceded by a space or the beginning of the string?

import re #input string example: input_text = "((VERB)ayudar a nosotros) ár((VERB)ayudar a nosotros) Los computadores pueden ((VERB)ayudar a nosotros)" #this give me a raise error("look-behind requires fixed-width pattern") re.error: look-behind requires fixed-width pattern #input_text = re.sub(r"(?<!^|\s)\(\(VERB\)", " ((VERB)", input_text) #and this other option simply places a space in front of all ((VERB) ) # without… Read More How to add a whitespace before "((VERB)" only if it is not preceded by a space or the beginning of the string?

Writing a proper regular expression that handles multiple spaces

I’m struggling to write a proper regexp to use with PHP7.4 to extract required information from a string. Here are the sample strings: Numer właściciela: NOWAKOWSKA 01-234 Warsaw Numer właściciela: NOWAK_S6_2 Numer właściciela: KOWALSKA_S6_ 01-234 Warsaw Numer właściciela: NOWACKI S6_ 01-234 Warsaw What I want to extract is accordingly: NOWAKOWSKA NOWAK_S6_2 KOWALSKA_S6_ NOWACKI S6_ So… Read More Writing a proper regular expression that handles multiple spaces

negating java regex

I’m using these lines to check if a String does not contain only "special" characters: String regex = "^[^a-zA-Z0-9]*$"; if(!someinput.matches(regex)){ System.out.println("your input isn’t made of only special characters"); } But I want the regex to not necessitate the "!" negation before it, so as to make it self-sufficient. I’ve tried the look ahead "^(?![^a-zA-Z0-9]*)$" ,… Read More negating java regex

Pandas REGEX not returning expected results using "extract"

I am attempting to use REGEX to extract connection strings from blocks of text in a pandas dataframe. My REGEX works on REGEX101.com (see Screenshot below). Link to my saved test here: https://regex101.com/r/ILnpS0/1 When I try to run the REGEX in a Pandas dataframe, I don’t get any REGEX matches/extracts (but no an error), despite… Read More Pandas REGEX not returning expected results using "extract"

JavaScript regex split consecutive string (vs Java)

I have this splitting regex to group consecutive words in String /(?<=(.))(?!\1)/g So in Java the above regex would split the string as I’m expected like this "aaabbbccccdd".split("(?<=(.))(?!\\1)"); // return [aaa, bbb, cccc, dd] but in JS the same regex will split like this, included my capture group 1 ‘aaabbbccccdd’.split(/(?<=(.))(?!\1)/g); /// return [‘aaa’, ‘a’, ‘bbb’,… Read More JavaScript regex split consecutive string (vs Java)