regex

findstr.exe is not working

My system has findstr.exe but when I try to execute it, it gives me the following error FINDSTR: Bad command line Tried so many things but unable to fix. I need to use regex in my batch script. Any other suggestion? ...

How can I further optimise this regular expression?

I have just coded the below regular expression. I have a mini rich text editor on a web page (very similar to the one I am using to post this question) and I want to make use of a double asterisk to indicate which words/phrases should be wrapped in a strong tag. The aim is to allow the user to add pre-defined HTML elements without actual...

how to find '/*N*/ ' using regexp

Hello, I don't want to learn regexps only for this particular problem. I need to find some '/*N*/ ' comments through C++ files. Can someone write a regexp which finds such comments? ...

How to strip out strange characters when consuming a feed?

I am consuming a couple of feeds at the same time and assembling one single feed. When grabbing and 'cleaning up' the description for a particular tag, I find bullet characters, that I cannot for the life of me 'remove' from the output. Doing a simple str_replace to find the • (just like that, not an li or ascii value) character does no...

Matching loosely formed urls using regex and php ?

Hi, I'm trying to identify urls in a set of text. However I would like to be able to identify loosly formed urls such as : example.com www.example.com I'm not very good at regex :( I found patter below but unfortunately it requires the scheme. /(([[:alnum:]]+:\/\/)|www\.)([^[:space:]]*)([[:alnum:]#?\/&=])/i Would it be possible t...

Fetching the matched string from the text using findstr

I have a text in some file like <Variable name="URL" value="http://url:port"/&gt; I want the url in the value tag( http://url:port ). The command and regex I'm using are FindStr /R /C:"\"URL\" *value=*\"*\"" <filename> The above regex matches the line in the file but fails to extract that url string any suggestion? ...

Regex question with using jQuery

I'm trying to create a Regex with jQuery so it will search for two words in an attribute of an XML file. Can someone tell me how to return a result that contains BOTH words (sport and favorite) in any order and any case (upper or lower case)? var regex = new RegExp("sport favorite", 'i'); var $result = $(data).filter(function() { ...

Regex for Reading ini with PHP

Sample ini file is [SAMPLE.jpg] faces=rect64(c18f4c8ef407851e),d4ff0a020be5c3c0;rect64(534a06d429ae627),dff6163dfd9d4e41;rect64(b9c100fae46b3046),e1059dcf6672a2b3;rect64(7b5105daac3a3cf4),4fc7332c107ffafc;rect64(42a036a27062a6c),ef86c3326c143248;rect64(31f4efe3bd68fd8),90158b3d3b65dc9b;rect64(327904e0614d390d),43cbda6e92fcb63e;rect64(42...

C# regexoptions.ignorecase doesn't seem to work...

Using the following code: string pat = @"ENGL101_.*_(.*)"; Regex r = new Regex(pat, RegexOptions.IgnoreCase); Matches: ENGL101_BELIEVE_WRIGHTSTONE.docx but not: Engl101_ThisIBelieve_Williams.docx IgnoreCase is on-- what's the issue?? ...

C# Regex.Replace(): getting the values

I'm parsing a BB code image tag: [img]http://imagesource.com[/img] I'm using the following Replace() function: Regex.Replace(msg, @"\[img\]([^\]]+)\[\/img\]", @"<img src=""$1"" border=""0"" />", RegexOptions.IgnoreCase); And I need to get the URL while parsing. I need to know the value of "$1". Is it possible? The Regex class so...

java String.replaceAll regex question

I have a string that contains the following text String my_string = "hello world. it's cold out brrrrrr! br br"; I'd like to replace each isolated br with <br /> The issue is that I'd like to avoid converting the string to "hello world. it's cold out <br />rrrrr! <br /> <br />"; What I'd like to do is convert the string (using ...

elegant way to match two wildcarded strings

I'm OCRing some text from two different sources. They can each make mistakes in different places, where they won't recognize a letter/group of letters. If they don't recognize something, it's replaced with a ?. For example, if the word is Roflcopter, one source might return Ro?copter, while another, Roflcop?er. I'd like a function that r...

Parsing Excel reference with regular expression?

Excel returns a reference of the form =Sheet1!R14C1R22C71junk ("junk" won't normally be there, but I want to be sure that there's no extraneous text.) I would like to 'split' this into a VB array, where a(0)="Sheet1" a(1)="14" a(2)="1" a(3)="22" a(4)="71" a(5)="junk" I'm sure it can be done easily with a regular expression, but I...

Regex Replacement

I have a string: users/554983490\/Another+Test+/Question????\/+dhjkfsdf/ How would i write a RegExp that would match all of the forward slashes NOT preceded by a back slash? EDIT: Is there a way to do it without using a negative lookbehinds? ...

How do I check to see if my string contains spaces using preg_match?

i use this code in php to detect if the string contains characters other than a-z,A-Z,0-9. I want to check if the string contains any spaces. What should I add to the pattern? if (preg_match ('/[^a-zA-Z0-9]/i', $getmail)) { // The string contains characters other than a-z and A-Z and 0-9 } ...

How do I use rstrip to remove trailing characters?

I am trying to loop through a bunch of documents I have to put each word in a list for that document. I am doing it like this. stoplist is just a list of words that I want to ignore by default. texts = [[word for word in document.lower().split() if word not in stoplist] for document in documents] I am returned with a list of...

Regex replace problem with (mostly) string content

Hey all; I'm trying to wrap all occurrences of an IP address with an HREF so I can then Do Stuff(tm). I've run the regex itself through several validators, and it matches pattern as expected. Therefore, I'm thinking my problem is in the implementation, but I can't see the correct path. Can anyone help out? Here's the regex and relev...

Eliminate the letters or marks out only leave numbers and apostrophe

the cases are listed below; 82&? 82,9 abse82,9>dpkg After Regex 82 82,9 82,9 Please help me to do it on c# with using Regex ...

Mass Search and Replace with Wildcards or Reg Expression MyString.Length to Len(MyString)

I have a large ASP.NET project where I want to do a mass search and replace (about 3500 instances) I want to change If strErrorMessage.Length > 0 If strSomeString.Length > 0 If strWhatever.Length > 0 and any other similar call to the Length method from a string to the following If Len(strErrorMessage) > 0 If Len(strSomeString) > ...

How do I remove these tags with JavaScript

I'm still learning regex (obviously) and i can't figure it out, and i want to do it the right way rather than doing it the long way. How can I: Find all <p> or </p> and replace with a \n except the first <p> and last </p> in which case replace with nothing, just remove, and for <br>, <br /> and <br/> replace with \n also. With Regex OR...