match

How do I loop through a regex's matches inside a replace in javascript?

I have the following JavaScript (the spaces in the <P>s are non-breaking): var html = '...<li>sub 2</li></ol></li></ol>\n\ <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n...

Given Server Relative URL, quickest way to find the last thing (i.e. after final slash)

I'm assuming: String abc = "My Documents/FileName.txt".Split('/')[1]; // is not the quickest way Is it? ...

javascript regex to match characters between two strings

Hey Folks, I am entirely new to regex, and am trying to use it to match vales in order to map them to variables (javascript looking at the output in responceText generated from a php script). At the moment I have this code: if (xmlhttp.readyState==4) { document.getElementById("test").innerHTML=xmlhttp.responseText; cmake = xmlh...

Match Regular expression from a dictionary in C#

I am trying to have some sort of Data Object (I'm thinking a dictionary) to hold a TON of regular expressions as keys, then I need to take a string of text, and match against them to get the actual value from the Dictionary. I need an efficient way to do this for a large set of data. I am in C# and I'm not sure where to begin. ...

Jquery: How to find text in textarea

Hello, I have array of keywords. How can I find if any of these keywords present in textarea? Is there any plugin or function to do that? Thank you ...

Can E4X Have An Array Passed To It?

Hi All, Say we have the following XML: <people> <person> <name>Jake</name> <skills> <skill>JavaScript</skill> <skill>HTML</skill> <skill>Flex</skill> <skill>CSS</skill> </skills> </person> <person> <name>John</name> <skills> <skill>C++</skill> <skill>Foxpro</skill> </skills> </person> <person> ...

SQL Statement Match Anything

I use a regex in my SQL statements for an app that look like this SELECT * FROM table WHERE id = {{REPLACEME}} However, sometimes I'm not giving a parameter to replace that string with. Is there a way to replace it with something that matches anything. I tried *, but that does not work. ...

Search for Binary Pattern in C (Read buffered binary file)

Hey there. I'm trying to write a small program that will read the four following bytes after the last occurrence of "0xFF 0xC0 0x00 0x11" which can be converted easily to binary or decimal. The purpose is that the 2-5 bytes following the last occurrence of that hex pattern represent the width and height of a JPEG file. #include <stdio.h...

Mysql match against alternative

I need a search with a relevance algorithm and the database is mysql. I have to sort the results by date, if keyword is in title or not, number of apparitions of the keyword in the text and so on. Match against doesn't give me that much control. ...

Regex match question

If I have a string such as lotsofcrap"somethingimportant"moreotherstuff is it possible to get Regex to match just whatever is between the " ", excluding the quotation marks? So the way to detect it would be something like ".*", but that will return "somethingimportant" rather than just pure somethingimportant ...

How to return a Ruby array intersection with duplicate elements? (problem with bigrams in Dice Coefficient)

Hi there I'm trying to script Dice's Coefficient, but I'm having a bit of a problem with the array intersection. def bigram(string) string.downcase! bgarray=[] bgstring="%"+string+"#" bgslength = bgstring.length 0.upto(bgslength-2) do |i| bgarray << bgstring[i,2] end return bgarray end def approx_string_match(test...

Excel Macro Match and Copy/Paste

Hi! I'm trying to build an Excel macro that will allow me to do the following: I have two excel sheets. I want the macro to match all the values in Sheet1, col A against cell A1 in Sheet2. If it matches, copy cell Dx from Sheet1 to cell D1 in Sheet2, if it doesn't just move on to cell A2 in Sheet2 and do the same, but copy cell Dx fro...

Load big XML files to mySQL database (PHP)

Hello There, For a new project I need to load big XML files (200MB+) to a mySQL database. There are +- 20 feeds i need to match with that (not all fields are the same). Now when i want to catch the XML I get this error: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 171296569 bytes) in E:\UsbWebserve...

JS: Check if var has "cheese" OR "cake" in it?

How can i check if a variable has something in it? I tried checking if a .match() returned null but that wasn't useful for checking with an OR? All ideas would be gratefully appreciated! ...

find match between 2 sql queries

I have two queries from v$sqlarea. For example query 1: select * from employee emp where emp.eid = 5 query 2: select * from employee v where v.eid = 15 Both are exactly the same in structure. but they will be compiled separately each time.. I need to match such queries that vary only by alias names or bind variables. The inbuilt ...

match array against string in java

I'm reading a file using bufferedreader, so lets say i have line = br.readLine(); I want to check if this line contains one of many possible strings (which i have in an array). I would like to be able to write something like: while (!line.matches(stringArray) { // not sure how to write this conditional do something here; br.readL...

Javascript regex in firefox extension

What could be going wrong here? The problem seems to be with the regex match statement. without it the alerts come, but as soon as I put it in everything goes quiet. Thanks so much! the wildcard is simply to help pinpoint the problem, it is NOT the objective, i do need regex. window.addEventListener("load", function() { myExtension.init...

How to pass a variable into regex in jQuery/Javascript

Is there a way to pass a variable into a regex in jQuery/Javascript? I wanna do something like: var variable_regex = "bar"; var some_string = "foobar"; some_string.match(/variable_regex/); In Ruby you would be able to do: some_string.match(/#{variable_regex}/) Found a useful post: http://stackoverflow.com/questions/185510/how-can...

How can I use LINQ to match words

I have a fair amount of questions and my first one is how can I do a simple LINQ query to match a word in a file? I'm not trying to be stupid but i haven't understood the documentation that I found for LINQ properly. ...

preg match email and name from to

i want to find name and email from following formats (also if you know any other format that been getting use in mail application for sending emails, please tell in comment :)) how can i know name and email for following format strings (its one string and can be in any following format): - [email protected] - james [email protected]...