regex

How are the new unicode domains going to be handled by email regexes?

Since In October 2009, the Internet Corporation for Assigned Names and Numbers (ICANN) approved the creation of country code top-level domains (ccTLDs) in the Internet that use the IDNA standard for native language scripts. I'm pretty sure that the standard regexes most sites currently use won't mark these as valid, or ...

^[A-Za-z](\W|\w)* regular expression?

the above expression is raise when user give first letter as white space and first letter should not be a digit and remaining letters may alpha numerical. i need when user give white space as a first character automatically it should trimed i need that one can u help me thank u ...

How to remove HTML tag in Java

Is there the regular expression that can completely remove a HTML tag? By the way, I'm using Java. ...

Regular expression in javascript?

Hi, i want to know how to write the regular expression in javascirpt please help me give a simple exaple with details i mean the source code(i am using asp.net and c# language) thank u ...

Getting DIV content with Regular Expression

Hello, How can I get content of a DIV using regular expression. What I need to get is in between; <div class="lv1right dfbg">......</div> Also there are several (not well defined) tags between these div tags, and I would like to get all of them.. Thanks in advance... ...

How to determine the "tipping point" especially when programming regex's?

G'day, Edit: While this question covers a situation that can arise in programming a lot, i have always noticed that there is a point when working with regex's, esp. in Perl and with shell-programming, where trying to capture those last few edge cases: requires much, much more time to expand your regex, which can mean excessive complex...

regular expression for special chars and numerics

Hi, I need a regular expression for accepting alpha numerics and special charecters also like : abc & def12 thanks in advance Nagesh ...

C# Way to serialize List<string> in settings containing any character (Regex/xml)

I am looking for a neat/clean way to store a list of strings into a C# settings file. As far as I can work out, you can't store List objects into these settings, so basically it needs to be converted to a string. For example, say I have a list of names: N*a*m*e*A Name;B Complex, Weird, Name Name"nickname"Person i.e. I am trying to ...

Regular expression with RedirectMatch does anything

Hi I use .htaccess to perform redirection. Here the line RedirectMatch permanent .*\?langue=([\w]{2}).*id_([\w]+)=([1-9]+) ***[protocol]***://myserver/rootContext/action?pagename=dir1/dir2/dir3/Redirect&type=$2&id=$3&lang=$1 Here my inital url: ***[protocol]***://localhost/adir/anotherDir/anotherDirAgian/oneMore/apage.php?langue=fr...

Regex matching words between whitespaces

Hi there. I need a regex that matches the following (the brackets indicate I want to match this section, they are not there in the actual string to be matched!): More Words: 6818 [some words] 641 [even more words] I tried it with following: (?<=[0-9]+\s)[a-z\s]+(?!\s{2,}) To say it in literals; "Match all words including ...

regex for four-digit numbers (or "default")

I need a regex for four-digit numbers separated by comma ("default" can also be a value). Examples: 6755 3452,8767,9865,8766,3454 7678,9876 1234,9867,6876,9865 default Note: "default" alone should match, but default,1234,7656 should NOT match. ...

Is it possible to negate a regular expression search?

Hi guys, I'm building a lexical analysis engine in c#. For the most part it is done and works quite well. One of the features of my lexer is that it allows any user to input their own regular expressions. This allows the engine to lex all sort of fun and interesting things and output a tokenised file. One of the issues im having is I w...

PowerShell -match operator and multiple groups

I have the following log entry that I am processing in PowerShell I'm trying to extract all the activity names and durations using the -match operator but I am only getting one match group back. I'm not getting all of the matches that I see when I do the same thing in C# using the Regex object. Can someone explain what I am doing wrong...

Splitting a Quoted Search String with Regular Expressions

I'm trying to figure out how to split a string into searchable terms. I need it to split on spaces and single quotes (ignoring single character, non-quoted results) return quoted phrases without the quotes So if I'm applying it to: "quoted phrase" single words It would return quoted phrase single words Here's what I have so far...

RegEx Validations

Hi: I am new to Reg Expressions. How can I check if a textbox can only hold Y,y,N,n values, Textbox 2 can only have string "abc" or "cba" What will be the ValidationExpression? I will really appreciate help. Thank you in advance. ...

C++, Boost regex, replace value function of matched value?

Specifically, I have an array of strings called val, and want to replace all instances of "%{n}%" in the input with val[n]. More generally, I want the replace value to be a function of the match value. This is in C++, so I went with Boost, but if another common regex library matches my needs better let me know. I found some .NET (C#...

C# regex and html, end at the first "

I want to get a url from a string. Heres my code to extract an img url. var imgReg = new Regex("img\\s*src\\s*=\\s*\"(.*)\""); string imgLink = imgReg.Match(page, l, r - l).Groups[1].Value; The result was http://url.com/file.png" border="0" alt=" How do i fix this so it ends at the first "? I tried something like ...

Escape a white space character using Javascript

I have the following jquery statement. I wish to remove the whitespace as shown below. So if I have a word like: For example #Operating/System I would like the end result to show me #Operating\/System. (ie with a escape sequence). But if I have #Operating/System test then I want to show #Operating\/System + escape sequence for s...

Regex Remove articles from title - the, an, a

I need a regular expression that will match the first letter of a song title without articles like "the", "an", "a". I'm writing a custom import script for Mediatomb which uses javascript. I need to be able to put songs in alphabetical folders. Example: "Panama.mp3" would be in folder "P", "The Gambler.mp3" would be in folder "G" ...

Is there a MySQL equivalent of PHP's preg_replace?

I have a to match a field in MySQL, for which I thought I could use a regular expression, but it appears that MySQL doesn't have the functionality I need to do the job. Here's the scenario: I have a variable in PHP called $url. Let's say this variable is set as the string "/article/my-article/page/2". I also have a table of URLs in M...