Skip to content

Tag: regex

Python Regex to Java

I am trying to convert a python regex to java. It finds a match in python but fails on the same string in java. Python regex : “(CommandLineEventConsumer)(x00x00)(.*?)(x00)(.*?)({})(x00x00)?([^x00]*)?”.format(event_consumer_name) Java regex : “(CommandLineEventConsumer)(\u0000\u0000)(.*?)(\u…

regEx codenameon

i’m working in the last part of my project in java i used pattern regExp for email and password verification and now i tried to use them in codenameone but it didn’t work maybe it’s because of the syntaxe or the import i searched but i found noting here’s the pattern i declared and i c…

Regex to consolidate multiple rules

I’m looking at optimising my string manipulation code and consolidating all of my replaceAll’s to just one pattern if possible Rules – strip all special chars except – replace space with – condense consecutive – ‘s to just one – Remove leading and trailing -&#82…

Extract digits in between two pipes padded with whitespace

I am struggling to use regex to find matches of the numbers between pipes {1, 2, 3, 4, 5, 6 …} in this line ; | 2021-08-18 01:28 | Twitter | [INTL TWITTER AAA BBB CC ] (https://twitter.c.xx-xx-2.aaaa.com/#/groups/123) | Twitter XX (C++, C#) | 1 | 2 | 3 | 4 | [ aaaa ] | 5 | 6 |

Regex to find strings that start and end with letter

I need to write a regex that checks if: string starts and end with letter contains only letters, numbers, _ and , _ can be present only between 2 letters, 2 numbers or a letter and a number , can be present only between 2 letters What i have until now is this: ^[a-zA-Z][(a-zA-Z0-9_)(,a-zA-Z0-9_)]*[a-zA-Z]$, b…

How to extract word in java using regex

Suppose I have a string How can I extract all the words from string s into a list which is between the pipe delimiter? So the list should save community, office, system. I thought of using the following pattern. Will it work? Answer You can use See the regex demo and regex #2 demo. Details: | – a | char

Generating RegEx pattern for a given string

I need to generate a RegEx pattern for a file name validation. But I am not used to RegEx pattern. I did try to generate patterns by using think link. I generated a pattern (^.*$)|(^.*i.*$) but it is not working as desired and got new pattern ^d+(?:_[A-Za-z]+)?$ from an answer but some new conditions are requ…

Regex pattern matching is getting timed out

I want to split an input string based on the regex pattern using Pattern.split(String) api. The regex uses both positive and negative lookaheads. The regex is supposed to split on a delimiter (,) and needs to ignore the delimiter if it is enclosed in double inverted quotes(“x,y”). The regex is &#8…

Another issue with RegEx in Java

I am going through a RegEx issue… again. Now, i am trying to search the following string: The ‘rules’: The first part: “< < * < ” Will be, as shown: two “<” one “*” and one “<“. Between them, there might be from zero to 5 spaces.…