Regular expression to match a string having string inside parenthisis

I want a create a regular expression that matches the certain rules. I found this RE – /^.*\(.*\).*$/g but i also wanted to have validation on second string inside parenthesis. eg- United Kingdom (English) Belgium (Dutch) ie- expression for [string space string inside parenthesis with at least 3 length of inside string.]. Thank you in… Read More Regular expression to match a string having string inside parenthisis

REGEXEXTRACT to capture group of strings between 2 characters

I have the following working gsheet formula that transposes, split, trims using REGEXEXTRACT which works to capture the first group of strings separated by OR =transpose(split(IFERROR(TRIM(REGEXEXTRACT(A2,"([^\()]+)")))," OR ",FALSE)) Example below using formula above ("AD" OR "AB" OR "ZZ" OR "Short Long" OR "Long Short") w/5 (("foo bar*" OR "bar* foo" OR "kit kat*") w/5 ("ping*… Read More REGEXEXTRACT to capture group of strings between 2 characters

How to match a string start and end with a character, don't care about the length of the string (using regex python)?

pattern = r"^gr.y$" if re.match(pattern, "grey"): print(‘Match1’) #Match1 if re.match(pattern, "greeey"): print(‘Match2’) #Don’t match if re.match(pattern, "greeeeeeeeey"): print(‘Match3’) #Don’t match Above is my code, but I want every string that starts with "gr" and ends with "y" satisfy the condition. I wonder if there and or condition in regex? Maybe satisfy condition 1 and condition… Read More How to match a string start and end with a character, don't care about the length of the string (using regex python)?

How to apply this regex to NSRegularExpression?

\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b https://www.regular-expressions.info/email.html How do I apply the regex above to an NSRegularExpression in Swift? I get a SIGABRT error when I run this code. func validEmail(from input: String) -> String? { do { let regex = try NSRegularExpression(pattern: #"\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b"#, options: .caseInsensitive) let range = NSRange(location: 0, length: input.utf16.count) let matches = regex.matches(in: input, options: [],… Read More How to apply this regex to NSRegularExpression?

Regular expression to find a number ends with special character in Swift

I have an array of strings like: "Foo", "Foo1", "Foo$", "$Foo", "1Foo", "1$", "20$", "1$Foo", "12$$", etc. My required format is [Any number without dots][Must end with single $ symbol] (I mean, 1$ and 20$ from the above array) I have tried like the below way, but it’s not working. func isValidItem(_ item: String) ->… Read More Regular expression to find a number ends with special character in Swift