regex-group

javascript - regexp exec internal index doesn't progress if first char is not a match

无人久伴 提交于 2021-01-28 05:06:53
问题 I need to match numbers that are not preceeded by "/" in a group. In order to do this I made the following regex: var reg = /(^|[^,\/])([0-9]*\.?[0-9]*)/g; First part matches start of the string and anything else except "/", second part matches a number. Everything works ok regarding the regex (it matches what I need). I use https://regex101.com/ for testing. Example here: https://regex101.com/r/7UwEUn/1 The problem is that when I use it in js (script below) it goes into an infinite loop if

Regex to match number with different digits and minimum length

*爱你&永不变心* 提交于 2021-01-27 14:24:11
问题 I am trying to write a regex (to validate a property on a c# .NET Core model, which generates javascript expression) to match all numbers composed by at least two different digits and a minimum length of 6 digits. For example: 222222 - not valid 122222 - valid 1111125 - valid I was trying the following expression: (\d)+((?!\1)(\d)) , which matches the sequence if has different digits but how can I constrain the size of the whole pattern to {6,} ? Many thanks 回答1: You may use ^(?=\d{6})(\d)\1*

Regex Recursion: Nth Subpatterns

邮差的信 提交于 2021-01-27 13:44:07
问题 I'm trying to learn about Recursion in Regular Expressions, and have a basic understanding of the concepts in the PCRE flavour. I want to break a string: Geese (Flock) Dogs (Pack) into: Full Match: Geese (Flock) Dogs (Pack) Group 1: Geese (Flock) Group 2: Geese Group 3: (Flock) Group 4: Dogs (Pack) Group 5: Dogs Group 6: (Pack) I know neither regex quite does this, but I was more curious as to the reason why the the first pattern works, but the second one doesn't. Pattern 1: ((.*?)(\(\w{1,}\)

Regex to find a multi line string that includes another string between lines

南楼画角 提交于 2021-01-27 08:16:47
问题 my first Q here. I have a log file that has multiple similar strings as hits: Region: AR OnlineID: Atl_Tuc ---Start--- FIFA 18 Legacy Edition ---END--- Region: FR OnlineID: jubtrrzz ---Start--- FIFA 19 Undertale Pro Evolution Soccer™ 2018 ---END--- Region: US OnlineID: Cu128yi ---Start--- KINGDOM HEARTS HD 1.5 +2.5 ReMIX ---END--- Region: RO OnlineID: Se116 ---Start--- Real Farm EA SPORTS™ FIFA 20 LittleBigPlanet™ 3 ---END--- Region: US OnlineID: CAJ5Y ---Start--- Madden NFL 18: G.O.A.T.

grab required field values from the paragraph block using regex in python

假装没事ソ 提交于 2020-12-15 04:57:30
问题 I've a text file, from that I have extracted these two paragraph block. The text example is give below. Text Example: EXONERAR, com validade a contar de 19 de agosto de 2020 , DE- NILSON DE BRITO LIMA , ID FUNCIONAL Nº 2100423-4 , do cargo em comissão de Coordenador , símbolo DAS-8 , da Coordenadoria de Gestão Centralizada de Serviços, da Superintendência de Gestão Centralizada, da Subsecretaria de Logística , da Secretaria de Estado de Planejamento e Gestão . Processo nº SEI- 120001/010643

Capture outer paren groups while ignoring inner paren groups

本小妞迷上赌 提交于 2020-08-10 19:34:09
问题 I'm using C# and regex, trying capture outer paren groups while ignoring inner paren groups. I have legacy-generated text files containing thousands of string constructions like the following: ([txtData] of COMPOSITE (dirty FALSE) (composite [txtModel]) (view [star3]) (creationIndex 0) (creationProps ) (instanceNameSpecified FALSE) (containsObject nil) (sName txtData) (txtDynamic FALSE) (txtSubComposites ) (txtSubObjects ) (txtSubConnections ) ) ([txtUI] of COMPOSITE (dirty FALSE) (composite