[Solved] C# Regex for Username

Try this code it will help you: (^[A-Z][a-z]{2,}_[A-Z][a-z]{2,}) using System; using System.Text.RegularExpressions; public class Example { public static void Main() { string pattern = @”(^[A-Z][a-z]{2,}_[A-Z][a-z]{2,})”; string input = @”Firstname_Lastname fi_na Fi_na fi_Na Fir_Name Firs_name firs_Name”; RegexOptions options = RegexOptions.Multiline; foreach (Match m in Regex.Matches(input, pattern, options)) { Console.WriteLine(“‘{0}’ found at index {1}.”, m.Value, m.Index); } … Read more

[Solved] need regex for youku video id [closed]

here’s how i would do it. id in first capture group. youku\.com/(?:player.php/sid/|v_show/id_)([a-zA-Z0-9]+)(?:/|\\.) i understand now that you use php as application language, which changes things a bit. you have to start and end the regular expression with a formality character of your own choice. for this regular expression i’d use the hash character, since it’s … Read more

[Solved] Removing a substring from a string in python

EDIT: to drop the end of the string starting from the character before the underscore, but preserving the extension you can use a regex: import re s = “ABC_Y6N02.20.0025D_BF3DAC.tgz.bin” print( re.sub(r”^(.*)[^_]_[^\.]*(\.tgz\.bin)$”, r”\1\2″,s ).lower()) returns abc_y6n02.20.0025.tgz.bin 1 solved Removing a substring from a string in python

[Solved] Javascript regex: issue when trying to parse both http and https instances of a natively archived string URL [closed]

A simpler expression should do the trick: var str = “https://web.archive.org/web/20030328195612/https://www.iskme.org:80/”; var url = str.match(/.*(https?:.*)/)[1]; The first .* will consume as many characters as possible up until the last occurrence of http(s): in the search string. 4 solved Javascript regex: issue when trying to parse both http and https instances of a natively archived string … Read more

[Solved] Remove only 3 characters after a specific string

You can use regex to selecting target part of string and run it in preg_replace(). $url = “http://aaa-aaaa.com/bbbb-bbbbbbbbbb-2/it/clients/”; echo preg_replace(“@(.*)\w{2}/([^/]+/)$@”, “$1$2”, $url); See result of code in demo solved Remove only 3 characters after a specific string

[Solved] how to write regex for this expression in java

The short answer: #a.+#((([A-Za-z]{3,9}:(?:\/\/)?)(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-]+|(?:www\.|[\-;:&=\+\$,\w]+@)[A-Za-z0-9\.\-]+)((?:\/[\+~%\/\.\w\-_]*)?\??(?:[\-\+=&;%@\.\w_]*)#?(?:[\.\!\/\\\w]*))?) This will match any character except line breaks in the content section, and should match any url. NOTE: You will have to escape all backslashes in the given regex to represent it as a java String literal. Sources for the url regex: What is the best regular expression to check if … Read more

[Solved] Regex for specific html tag in C# [duplicate]

instead of using a regex using something like an xml parser may be more useful to your situation. Load it up into an xml document and then use something like SelectNodes to get out your data you are looking for http://msdn.microsoft.com/en-us/library/4bektfx9.aspx 2 solved Regex for specific html tag in C# [duplicate]

[Solved] Regex for this format [40]*100+ [closed]

This regexp tests for the format you describe: /^(\[\d{1,3}\]\*\d{1,3}\+)+$/ \d{1,3} matches up to 3 digits. We put one of these inside literal [], with literal * after that, and literal + after the second one. Then we use a quantified group to allow multiple repetitions. You can’t do the validation until the user has finished … Read more

[Solved] Regular Expression – date format [closed]

You need to escape ‘.’ It is being matched with any character. Try this (Jan\.|Feb\.|Mar\.|Apr\.|May\.) Instead of this better use single dot in the end ((Jan|Feb|Mar|Apr|May)\.) 4 solved Regular Expression – date format [closed]

[Solved] I want regular expression (theory of automata)

Going completely classic regular expression (i.e. disjunction, concatenation, and kleene star): (799|(8|9)(0|1|2|3|4|5|6|7|8|9)(0|1|2|3|4|5|6|7|8|9)(0|1|2|3|4|5|6|7|8|9)*|(1|2|3|4|5|6|7|8|9)(0|1|2|3|4|5|6|7|8|9)(0|1|2|3|4|5|6|7|8|9)(0|1|2|3|4|5|6|7|8|9)(0|1|2|3|4|5|6|7|8|9)*) If you allow typical regex shorthands (but stay within the theoretical limits, i.e. a regular language), that can be reduced to: 799|[89]\d{2,}|[1-9]\d{3,} You match either the number 799, a three digit number starting with 8 or 9, or a four- (or more) -digit … Read more

[Solved] Email Regex not working for some conditions

I was having specific rules for my requirement. I found the correct regex for my problem i.e. ^([^.])([a-zA-ZA-zàèìòùÀÈÌÒÙáéíóúýÁÉÍÓÚÝâêîôûÂÊÎÔÛãñõÃÑÕäëïöüÿÄËÏÖÜŸçÇßØøÅåÆæœ0-9.!#$%&’+=?^_`{|}~/-])+([^.])@[a-zA-ZA-zàèìòùÀÈÌÒÙáéíóúýÁÉÍÓÚÝâêîôûÂÊÎÔÛãñõÃÑÕäëïöüÿÄËÏÖÜŸçÇßØøÅåÆæœ0-9]+([a-zA-ZàèìòùÀÈÌÒÙáéíóúýÁÉÍÓÚÝâêîôûÂÊÎÔÛãñõÃÑÕäëïöüÿÄËÏÖÜŸçÇßØøÅåÆæœ0-9.-]+([a-zA-Z0-9]))$ Rules were For Email local part: 1) Latin letters are allowed: A to Z and a to z 2) Number are allowed: 0 to 9 3) Following special characters are allowed: !#$%&’*+-/=?^_{|}~<br> 4) Dot “.” is allowed … Read more