Hi,
I need to find all invocations of some logging macros in the code. The macro invocation is of the form:
DEBUG[1-5] ( "methodName: the logged message", arguments)
But the new versions of the macros are prepending the name of the method automatically, so my task is to write a Python script that will remove the duplicate function na...
I have an application loading CAD data (Custom format), either from the local filesystem specifing an absolute path to a drawing or from a database.
Database access is realized through a library function taking the drawings identifier as a parameter.
the identifiers have a format like ABC 01234T56-T, while my paths a typical windows P...
I am looking to search for and replace a known string from within another string. Should I use str_replace() or preg_replace()? The string to be replaced would be something similar to [+qStr+], [+bqID+], or [+aID+] and it would be being searched for in a code chunk similar to this:
<li> [+qStr+]
<ol class="mcAlpha">
<li><input...
Is there an easy way to create an acronym from a string in MATLAB? For example:
'Superior Temporal Gyrus' => 'STG'
...
I have this code:
$string = "123456ABcd9999";
$answer = ereg("([0-9]*)", $string, $digits);
echo $digits[0];
This outputs '123456'. I'd like it to output '1234569999' ie. all the digits. How can I achieve this. I've been trying lots of different regex things but can't figure it out.
...
I have a situation where something can appear in a format as follows:
---id-H--
Header: data
Another Header: more data
Message: sdasdasdasd
Message: asdasdasdasd
Message: asdasdasd
There may be many messages, or just a couple. I'd prefer not having to step outside of RegEx, because I am using the RegEx to parse some header information...
I'm trying to get my Javascript code 100% JSLint clean.
I've got a regular expression:
linkRgx = /https?:\/\/[^\s;|\\*'"!,()<>]+/g;
JSLint reports:
Insecure '^'
What makes the use of the negation of the character set "insecure" ?
...
Hi. I have a list of regexes in python, and a string. Is there an elegant way to check if the at least one regex in the list matches the string? By elegant, I mean something better than simply looping through all of the regexes and checking them against the string and stopping if a match is found.
Basically, I had this code:
list = ['s...
I'm looking for some regular expression to help parse my CSV file.
The file has lines of
number,number
number,number
Comment I want to skip
number,number
number,number
Ex:
319,5446
564425,87
Text to skip
27,765564
I read each line into a string and I wanted to use some regular express to make sure the line matches the pattern of ...
Based on this answer
http://stackoverflow.com/questions/469913/regular-expressions-is-there-an-and-operator
I tried the following on http://regexpal.com/ but was unable to get it to work. What am missing? Does javascript not support it?
Regex: (?=foo)(?=baz)
String: foo,bar,baz
...
I am trying to run some regular expressions(grep) on a text file of about 4K lines. The main portion that I need replaced looks like this:
1,"An Internet-Ready Resume",1,2,"","
And I need it to look like this:
<item>
<title>An Internet-Ready Resume</title>
<category>1</category>
<author>2</author>
<content>
So far, this is what I ...
I'm trying to extract the mileage value from different ebay pages but I'm stuck as there seem to be too many patterns because the pages are a bit different . Therefore I would like to know if you can help me with a better pattern .
Some examples of items are the following :
http://cgi.ebay.com/ebaymotors/1971-Chevy-C10-Shortbed-Truck-/25...
Possible Duplicate:
help with regex needed
I need a regular expression for which:
the string is alphanumeric and have exactly 6 characters in the first half followed by hyphen(optional) followed by optional 4 characters:(cannot have more than 4 characters in the second half)
so any of the following is valid
11111A
111111-1
...
I have the following text
<pattern name="pattern1"/>
<success>success case 1</success>
<failed> failure 1</failed>
<failed> failure 2</failed>
<unknown> unknown </unknown>
<pattern name="pattern4"/>
<pattern name="pattern5"/>
<success>success case 3</success>
<pattern name="pattern2"/>
<success>success case 2</success>
...
In the following:
<span>This cost $15.99 per item</span>
how do I return "$15.99" using jquery? The value can also be for example "$7".
...
Hi
I am trying to import this:
http://en.wikipedia.org/wiki/List_of_countries_by_continent_%28data_file%29
which is of the format like:
AS AF AFG 004 Afghanistan, Islamic Republic of
EU AX ALA 248 Åland Islands
EU AL ALB 008 Albania, Republic of
AF DZ DZA 012 Algeria, People's Democratic Republic of
OC AS ASM 016 American Samoa
EU AD ...
Hello,
I am trying to replace a variable stored in another file using regular expression. The code I have tried is:
r = re.compile(r"self\.uid\s*=\s*('\w{12})'")
for line in fileinput.input(['file.py'], inplace=True):
print line.replace(r.match(line), sys.argv[1]),
The format of the variable in the file is:
self.uid = '027FC8E...
I want to match both the src and title attributes of an image tag:
pattern:
<img [^>]*src=["|\']([^"|\']+["|\'])|title=["|\']([^"|\']+)
target:
<img src="http://someurl.jpg" class="quiz_caption" title="Caption goes here!">
This pattern gives me one unwanted match, title="content", and the match I actually want which is the value b...
^.+\\(.*\\)
I am struggling to work this one out, any help would be greatly appreciated...
also is there a site that lets youu paste in a regular expression then spits out in plain text what it means?
...
i have this code:
<script type="text/javascript">
var str="KD-R35H2UND";
var patt1=/[G|T|EE|EJU].*D/i;
document.write(str.match(patt1));
</script>
by using code at var patt1=... i can show like this:
if i type KD-R35ED => SHOW ED
KD-R35UND => UND
KD-R35JD => JD
KD-R35TJD => TJD
KD-R35EED=> EED
my problem is: if i type KD-R35GD it c...