Skip to content

Tag: regex

Regex to match only 6letter alphanumeric words in a string

I am trying to match the 6 character word that has a combination of ONLY alphanumeric. Example String: I am currently trying regex [a-zA-Z0-9]{6} However, it matches below Output: But, what I need is only combination of alphanumeric. Something like below Desired Output Answer You may use this regex with 2 lookahead conditions: RegEx Demo RegEx Details: b: Word boundary

Regex to return all subdomains from a given domain

Given a domain string like aaaa.bbbb.cccc.dddd I am trying to iterate over all of its subdomains i.e. I thought this regex ((?:[a-zA-Z0-9]+.)*)([a-zA-Z0-9]+)$ should do the trick (please ignore the fact, that I am only matching these characters [a-zA-Z0-9]), however it only matches the full string. How can I modify it to make it work? Edit 1: The following code should

Regex match any of the words separated by slashes

I need to develop a validation pattern for catching any kind from: pdf/csv/xlsx select any separate word is simple: (pdf|csv|xlsx). However, I need to check that any combination with them separated by slash is fine as well. For example, correct flow: Incorrect: Answer You may use this regex: RegEx Demo

Check if string contains number after specific word [closed]

Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 months ago. Improve this question can someone help me with string validation? I tried to find the solution, but none was satisfied. I have the

Get all possible matches in a regex match (In Java)?

I am using a regex to match few possible values in a string that coming with my objects, there I need to get all possible values that are matching from my string as below, If my string value is “This is the code ABC : xyz use for something”. Here is my code that I am using to extract matchers,

Validate string like “abc=def,123,xyz” with regex

I would like to verify the syntax of an input field with a regex. The field should accept text like the following examples: There has to be a word, a = sign and a list of comma separated words. The list must contain at least one entry. So abc= should be invalid, but abc=123 is valid. I am using a