Skip to content
Advertisement

Tag: regex

Find passwords values in JSON objects using Regex

I have a big JSON object which contains a lot of different JSON, most of them have the structure below (key: sometext-v1.password, and value: password for example: I want to use Regex to extract all passwords by a name which contains ‘password’ string and its value, but I don’t want to iterate the JSON name by name because this takes

How can I get a special part in a string in Java? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question I have to read commands from a file I have and take necessary actions according to each command. I was able to find out the

Regular expression to match optional patterns

I know that Regex is a pretty hot topic and that there’s a plethora of similar questions, however, I have not found one which matches my needs. I need to check the formatting of my string to be as follows: All line must start with 5 digits. Characters 6 to 12 must be white space. Character 13 must be either

Java regular expression to match valid Java identifiers

I need to create a regular expression able to find and get valid identifiers in Java code like this: I have tried to add multiple regexes in a single regex, but how can I build a pattern to exclude reserved words? I tried this regex ^(((&&|<=|>=|<|>|!=|==|&|!)|([-+=]{1,2})|([.!?)}{;,(-]))|(else|if|float|int)|(d[d.])) but it does not work as expected. Online demo In the following picture, how

Allow only left aligned zeros using regex

I am fairly new to using regex. I have a serial number which can take the following forms: VV-XXXXXX-P or VVXXXXXXP If the hyphen variant is used, then the number of ‘X’ can be variable. For example 01-162-8 is equivalent to 010001628. In order to identify the 2 formats, I have created the following regex’s: However the issue with the

Advertisement