regex

Regular expression for postscript code

I'm trying to write a regular expression for this. I need it to grab the 9 digit number that's in brackets provided a '6 /Helvetica-Bold f' has appeared before it but not a '6 /Helvetica f' 6 /Helvetica-Bold f 6 /Helvetica <-- any number of lines of other text --> 261 632 m(436243874)r 1 9 0 Endline <--- this would not match 6 /Helv...

Regexp Java for password validation

I'm creating a regexp for password validation that will be used in a Java Application as a configuration parameter. The regexp is: ^.*(?=.{8,})(?=..*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=]).*$ The password policy is: At least 8 chars Contains at least one digit Contains at least one lower alpha char and one upper alpha char Cont...

How do I parse recurring pattern with regex

I want to use regex to find unknown number of arguments in a string. I think that if I explain it would be hard so let's just see the example: The regex: @ISNULL\('(.*?)','(.*?)','(.*?)'\) The String: @ISNULL('1','2','3') The result: Group[0] "@ISNULL('1','2','3')" at 0 - 20 Group[1] "1" at 9 - 10 Group[2] "2" at 13 - 14 Group[3] ...

Regex filter &quot; with &lt;&gt; tags included

Hello, am having problems with some Regex code can anyone help. I have the following string of data see below: abcd &quot; something code &quot; nothing &quot;f &lt;b&gt; cannot find this section &lt;/b&gt; &quot; I want to find the sections between &quot; quotes. I can get if to work fine using the following regax: foreach (Match...

problem writing regular expression

I am trying to write a regular expression that matches only any of the following: {string} {string[]} {string[6]} where instead of 6 in the last line, there could be any positive integer. Also, wherever string appears in the above lines, there could be int. Here is the regular expression I initially wrote : {(string|int)(([]|[[0-9]]...

What will be the regular expression for a fixed format of alphanumeric value

I have a problem where I need to see if the textbox entry is an alphanumeric value. The format for this entry Character(A-Z) then Number(0-9), where there's only one alphabet and Numbers can be as many as he wants.The lphabet should always come first.A minimum of 2 characters have to be entered. Example is A100, A1. It should not accept ...

RegEx JavaScript problem

I have this text: <body> <span class="Forum"><div align="center"></div></span><br /> <span class="Topic">Text</span><br /> <hr /> <b>Text</b> Text<br /> <hr width=95% class="sep"/> Text<a href="Text" target="_blank">Text</a> <hr /> <b>Text</b> -Text<br /> <hr width=95% class="sep"/> **Text what i need.** <...

how to highlight part of textarea html code

I want to achieve a python version web regexbuddy,and i encounter a problem,how to highlight match values in different color(switch between yellow and blue) in a textarea,there has a demo what exactly i want on http://regexpal.com,but i was a newbie on js,i didn't understand his code meaning. any advice is appreciated ...

java string regex

could someone help me out with a piece of regex please? I want to stop the user entering any charachter other than a-z or a hyphen - Hope someone can help me. Thanks ...

Using regex in python

Hello, i have the following problem. I want to escape all special characters in a python string. str='eFEx-x?k=;-' re.sub("([^a-zA-Z0-9])",r'\\1', str) 'eFEx\\1x\\1k\\1\\1\\1' str='eFEx-x?k=;-' re.sub("([^a-zA-Z0-9])",r'\1', str) 'eFEx-x?k=;-' re.sub("([^a-zA-Z0-9])",r'\\\1', str) I can't seem to win here. '\1' indicates the spe...

Regex for RM-EC001 (in sql-server)

Hello, i have a text and want to find all occurences of: prefix RM-EC + 3 digit number. For example RM-EC001, RM-EC099 or RM-EC100. But RM-EC99 should not be found. Thank you. ...

Regexp to insert string in the beginning of anchor tag?

I need to insert a string directly after the open anchor ends (where the anchor content starts). Here is my code: <ul id="menu-topmenu2" class="menu"> <li id="menu-item-5" class="menu-item menu-item-type-post_type menu-item-5"> <a href="http://localhost/domain/barnlager.se/?page_id=2"&gt; About </a> ...

Replace UL tags with specific class

Hi, I'm trying to replace all ul tags with a level0 class, something like this: <ul> <li>Test <ul class="level0"> ... </ul> </li> </ul> would be processed to <ul> <li>Test</li> </ul> I tried $_menu = preg_replace('/<ul class="level0">(.*)<\/ul>/iU', "", $_menu); but it's not working,...

Finding Duplicates (Regex)

I have a CSV containing list of 500 members with their phone numbers. I tried diff tools but none can seem to find duplicates. Can I use regex to find duplicate rows by members' phone numbers? I'm using Textmate on Mac. Many thanks ...

Validation Expression for UserName using C#

Hi..all I am developing a login form with User Name and Password. I want the user to create the username in a specified format. So i am using RegularExpressionValidator for the username. What is the Validation Expression for this format. The format is: xyz\\t4z4567 (characters are not case sensitive) Rules: The username will be cr...

Address data extraction from text via asp.net (vb.net)

I have address data that is surrounded by random text. Is there a way to extract this data either with a call to a web service or some vb.net function? example: 1111 S WILSON ROAD APT B8 CITY STATE 55555 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

Iterating Over Regexp Matches with Sed and Bash?

How can I iterate over multi-line regexp matches using sed and bash? I'm trying to generate some quick docs from comments in a file, like so: /** * @name myFun * @return {int} */ I can extract every comment block using sed -n -e '/\/\*\*$/,/\*\/$/p', but now I'd like to stuff each match into a bash array so I can parse the details ...

Complicated problem. Need help with regular expression replace.

Hello, I'm in the process of updating a program that fixes subtitles. Till now I got away without using regular expressions, but the last problem that has come up might benefit by their use. (I've already solved it without regular expressions, but it's a very unoptimized method that slows my program significantly). TL;DR; I'm trying ...

How to formulate Regular expression for given example

I'm not very well versed with regular expressions. I've had to use them, maybe once every few years, and that was mostly for course work. Anyways, the following question should be a fairly straight forward question/answer for anyone familiar with regular expressions. I need to ensure that the text entered into a field follows the follow...

Match pattern of [0-9]-[0-9]-[0-9], but without matching [0-9]-[0-9]

I'm not sure how to accomplish this with a regular expression (or if I can; I'm new to regex). I have an angle value the user will type in and I'm trying to validate the entry. It is in the form degrees-minutes-seconds. The problem I'm having, is that if the user mistypes the seconds portion, I have to catch that error, but my match f...