regex

Replacing specific HTML tags using Regex

Alright, an easy one for you guys. We are using ActiveReport's RichTextBox to display some random bits of HTML code. The HTML tags supported by ActiveReport can be found here : http://www.datadynamics.com/Help/ARNET3/ar3conSupportedHtmlTagsInRichText.html An example of what I want to do is replace any match of <div style="text-align:*<...

using regular expression / Remove special characters with linq to sql

How can i use regular expressions with linq to sql in the asp.net mvc(C#) application? The columns in my MSSQL table (Products) has some special characters like (, - % ',.....). While searching for a product i need to search without that special chareters. For ex.: I have a product say (ABC-Camp's / One), when i search for "abccamp",...

jquery sortable with regexp

I am trying to figure out the right regexp to match on list item id's. For example: <ul id="MyList" class="connectedSortable"> <li id="id=1-32">Item 1</li> <li id="id=2_23">Item 2</li> <li id="id=3">Item 3</li> <li id="id=4">Item 4</li> <li id="id=5">Item 5</li> <li id="id=6">Item 6</li> </ul> On the serialize...

Can I use a static library compiled with gcc 3.4.2 with gcc 4.2.2

I have a static library that is compiled with gcc 3.4.2. I am building a shared library that relies on this static lib. I will be building this shared library (.so) with gcc 4.2.2. I was wondering what are the potential pitfalls of using the 3.4.2 static library in a gcc 4.2.2 shared library? ...

Javascript regular expressions: how to match ONLY the given characters?

I'm trying to use a regex like /[computer]{3,8}/ to get any words containing only the letters in computer ranging from 3 to 8 letters long. That regex instead captures all words containing ANY of the letters in [computer]. I've been looking at regular expression examples, but i can't quite figure it out... How do i modifiy this regular ...

.NET Regex: Howto extract IPv6 address parts

Question: How does the .NET regex string to extract IPv6 addresses look like ? I can get it to extract a simple IPv6 address like "1050:0:0:0:5:600:300c:326b" but not the colon format ("ff06::c3"); My problem is, it should extract a 0 for every omitted value between the :: How do I do that? Below my code + description. Specify IPv6 a...

Java how to replace 2 or more spaces with single space in string and delete leading spaces only

Looking for quick, simple way in Java to change this string " hello there " to something that looks like this "hello there" where I replace all those multiple spaces with a single space, except I also want the one or more spaces at the beginning of string to be gone. Something like this gets me partly there String mytext =...

Can anyone decipher this for me? PHP (I think)

This code is being used to parse email, it's stored as a table in a mySQL database. I believe it's PHP code. What does the (.+) do? /A new order has been successfully placed through(.+)Name:(.+)Company:(.+)Email:(.+)Address 1(.+)Order ID:(.+)Date:(.+)Payment Type:(.+)Order Status:(\s*)Accepted(.*)\n(.+)\$([\d\.]+)\s+X/si Thanks, sup...

Finding the complement of a regular expression

There's a question on my exercise sheet to find the complement of r = (a|b)*ab(a|b)* I've come up with a solution, but I'm not sure if it's correct. Please help me to check, and correct my errors. Thanks in advance. ...

How to replace "(" and ")" with "<span>" and "</span>" jQuery

I have follow html code: <a href="#">Evente (0)</a> an i need: <a href="#">Evente <span>0</span></a> how i can change it with jQuery? ...

Escape characters contained by bash variable in regex pattern

In my bash script, i am trying to execute following Linux command: sed -i "/$data_line/ d" $data_dir $data_line is entered by user and it may conatain special characters that could brake regex. How can i escape all of the possible special characters in $data_line before i execute sed command? ...

Regex for beautify text

HI, I would like to create a function that beautify my text. For this I use a regex who remplace some characters, but it not run. Can you give me the regular expression for this : Replace the first letter by a caps Replace any underscore _ by a space So for example: the_pack_2 will be The pack 2. Thx ...

Jointure in linq with a regular expression

I'm actually using a join in linqtosql (via dblinq). I'm trying to include a regular expression in the join part of the linq query. from i in collectiona join j in collectionb on Regex.IsMatch(i.name, j.jokered_name) equals true (...) I agree i can push the RegExp check in the where part of the linq query, but i was wondering if it i...

pattern for the following condition in java

hi i want to know how to write pattern.. for example : the word is "AboutGoogle AdWords Drive traffic and customers to your site. Pay through Cheque, Net Banking or Credit Card. Google Toolbar Add a search box to your browser. Google SMS To find out local information simply SMS to 54664. Gmail Free email with 7.2GB storage ...

help with .htaccess RewriteRule

What is the rewrite rule for following URL mysite.com/001234-some-keywords.html I want to capture the 6 digit reference number something like ([0-9]{6}) my indexed file is templates/default/index.php?ref=001234 One day I do a crashcourse regex.. I promise. ...

.NET regular expression

How would I write a regular expression (C#) which will check a given string to see if any of its characters are characters OTHER than the following: a-z A-Z Æ æ Å å Ø ø - ' ...

How to recall search pattern when writing replace regex pattern in Vim?

Here's the scenario: I've got a big file filled with all sorts of eclectic rubbish that I want to regex. I fiddle around and come up with a perfect search pattern by using the / command and seeing what it highlights. Now I want to use that pattern to replace with. So, I start typing :%s/ and I cannot recall what the pattern was. Is ther...

Regex - Trim character at the end of a string

I am trying to remove a trailing - (dash) at the end of the string. Here is my code: <?php $str = 'SAVE $45! - Wed. Beach Co-ed 6s (Jul-Aug)'; echo ereg_replace('([^a-z0-9]+)','-',strtolower($str)); ?> produces this: save-45-wed-beach-co-ed-6s-jul-aug- How can I remove a specific trailing character only if its there, in this c...

Parse Text using scanner useDelimiter

Looking to parse the following text file: Sample text file: <2008-10-07>text entered by user<Ted Parlor><2008-11-26>additional text entered by user<Ted Parlor> I would like to parse the above text so that I can have three variables: v1 = 2008-10-07 v2 = text entered by user v3 = Ted Parlor v1 = 2008-11-26 v2 = additional text entered...

Help with this reg. exp. in PHP

Hi, i don't know about regular expressions, I asked here for one that: gets either anything up to the first parenthesis/colon or the first word inside the first parenthesis. This was the answer: preg_match('/(?:^[^(:]+|(?<=^\\()[^\\s)]+)/', $var, $match); I need an improvement, I need to get either anything up to the first parenthesis...