regex

How to match with javascript and regex?

I have the following HTML: <span id="UnitCost5">$3,079.95 to $3,479.95</span> And i want to use Javascript and Regex to get all number matches. So i want my script function to return: 3,079.95 AND 3,479.95 Note the text may be different so i need the solution as generic as posible, may be it will be like this: <span id="UnitCost5">...

RegExp Counting System

I'm trying to create a system where I can convert RegEx values to integers and vice versa. where zero would be the most basic regex ( probably "/./" ), and any subsequent numbers would be more complex regex's My best approach so far was to stick all the possible values that could be contained within a regex into an array: values = [ "...

Regular expression get info from string [PHP]

How do I fill an array like this: array('0' => 'blabla','1' => 'blabla2') from a string like this: '#blabla foobar #blabla2' using preg_match()? ...

Ksh script: Run bash-like character substitute: ${@/.txt/}

I have a ksh script that has to remain so (some of the programs it runs insist on being ksh). I want to take the input argument "test.txt" and remove the last 4 characters or find and replace the ".txt" with nothing. In bash I would do NewVar=${@/.txt/} This doesn't work in ksh though. How can I get rid of the .txt in ksh? I tried ...

C# String Manipulation using Regular Expressions

My application collects HTML content provided by internal users that is used to dynamically build articles on company web site. I want to implement a feature whereby users can surround a word/phrase in the HTML content with a special tag called <search>....</search> and when the content is saved in the database, the application will con...

C# .net Regular Expressions

I have three sentences as follows: 000000-00000 Date First text: something1 200000-00000 Time Second text: something2 234222-34332 struc Third text: somthing3 How do I write a regex to match between (Date|Time|struc) and the colon (:), not including (Date|Time|struc)?. ...

java regex support for non-ascii values?

We have a current method which clears out chars that are not alphabetic or whitespace which is simply String clean(String input) { return input==null?"":input.replaceAll("[^a-zA-Z ]",""); } which really ought to be fixed to support non-english chars (e.g. ś,ũ, ... ). Unfortunately the java regex classes (e.g. "\W" -A non-word ...

simple SED command

I have a html report that comes out of a program we use. Its extremely plain html and id like to work on fixing it up just a bit. What code would I need to do in sed to replace <html> with <html><link rel="stylesheet" type="text/css" href="LivingInStyle.css"> Thanks, Russ ...

Tokenizing Error: java.util.regex.PatternSyntaxException, dangling metacharacter '*'

I am using split() to tokenize a String separated with * following this format: name*lastName*ID*school*age % name*lastName*ID*school*age % name*lastName*ID*school*age I'm reading this from a file named "entrada.al" using this code: static void leer() { try { String ruta="entrada.al"; File myFile = new File (ruta...

Self learning regular expression or xpath query?

Hi! Is it possible to write code which generates a regular expression or xpath that parses links based on some html document? What i want is to parse a page for some links. The only thing i know is that the majority of the links on the page is those links. For a simple example, take a google search engine results page, for example th...

.Net Regex match grouping and repetition question

I have the following VB.Net 2.0 in an ASP.Net app: output = Regex.Replace(output, "<p>(?:(?:\<\!\-\-.*?\-\-\>)|&(?:nbsp|\#0*160|x0*A0);|<br\s*/?>|[\s\u00A0]+)*</p>", String.Empty, RegexOptions.Compiled Or RegexOptions.CultureInvariant Or RegexOptions.IgnoreCase Or RegexOptions.Singleline) Example stuff it matches well: <p></p> <p> ...

Regex - Multiline Problem

I think I'm burnt out, and that's why I can't see an obvious mistake. Anyway, I want the following regex: #BIZ[.\s]*#ENDBIZ to grab me the #BIZ tag, #ENDBIZ tag and all the text in between the tags. For example, if given some text, I want the expression to match: #BIZ some text some test more text maybe some code #ENDBIZ At the mom...

Regex for extracting Movie name from filename.

Hi Guys, imagine if you will the following string: "A Great Movie (1999) DVDRip.avi" I am looking to extract the string "A Great Movie" from this via regex, but struggling to get the correct regex for this. I would be using this too parse file names of various length. thanks! ...

Difference between regular expression modifiers 'm' and 's'?

i often forget about the regular expression modifier "m" and "s" and their differences. what is a good way to remember them? as i understand them, they are: 'm' is for multiline, so that ^ and $ will match beginning of string and end of string multiple times. (as divided by "\n") 's' is so that the dot will match even ...

MySQL string replace

Hey, what's the most effective way to remove beginning and ending slashes from all rows in a particular column using MySQL? Before: /hello/world/ foo/bar/ /something/else /one/more/* After: hello/world foo/bar something/else one/more/* ...or maybe this should be done in PHP instead? ...

Regular Expression to find files with various extensions like-ASPX,ASCX,.js,.rpt,.xml

Is there any way to write a RegEx which can be used to find files with different Extensions. ...

How to use regular expression in WatiN

Hi I'm working on WatiN automation tool. I'm having problem in regular expression. I've situation where i have to enter some text and click on a button in the popup window. I'm using AttachToIE method and URL attribute("http://192.168.25.10:215/admin/SelectUsers.aspx?Type=FeedbackID=ef5ad7ef5490-4656-9669-32464aeba7cd") of the popup to...

Replace words from querystring with Regular Expressions

Hello the string is = "Reg.asp?q=RG_Price=5000*8000,Activated=1" and i want to replace "RG_Price=5000*8000" with that "Price BETWEEN 5000 AND 8000". Is that possible with Regular Expressions in ASP ? ...

C# regex with line breaks

Hello I have the following code namespace ConsoleApplication2 { class Program { static void Main(string[] args) { string searchText = "find this text, and some other text"; string replaceText = "replace with this text"; String query = "%SystemDrive%"; string str ...

How to find information in a file using regular expressions on Linux

Hi, I have a file with many lines in it. One of them look like : set auto_upgrade {1 2 3 4} The list can contain more numbers. Now, in a shell script I want to look into this file and find out what is the last number in the list. In the example above, it should find 4. I have a regular expression to find this : set auto_upgrade {...