What would be the correct way to find a string like this in a large xml:
<ser:serviceItemValues>
<ord1:label>Start Type</ord1:label>
<ord1:value>Loop</ord1:value>
<ord1:valueCd/>
<ord1:activityCd>iactn</ord1:activityCd>
</ser:serviceItemValues>
1st in this xml there will be a lot of repeats of the element above with d...
I have URLs like
/?test that I want to rewrite to /page.php?page=test
I tried like this but for some reason it doesn't work.
RewriteRule ^\?([a-z0-9\-\+]{3,20})/?$ /page.php?page=$1 [NC,QSA]
What am I doing wrong?
...
I have the following pattern:
(COMPANY) -277.9887 (ASP,) -277.9887 (INC.)
I want the final output to be:
COMPANY ASP, INC.
Currently I have the following code and it keeps returning the original pattern ( I assume because the group all falls between the first '(' and last ')'
Pattern p = Pattern.compile("((.*))",Pattern.DOTALL);
Ma...
I'm working on implementing a way to allow HTML in a field that I have with PHP. The characters are saved to the database as they are inputted, so when I print them to the screen later on, I want the HTML to be respected (security is not an issue here, so please don't make it one). What I need right now is a way to change any " inst...
Hi,
How can I write a regular expression to match "SS19100025" type of string?
Start with 2 "S" then "191" then after 5 digit number.
Thanks a lot,
devweb
...
Consider a string that looks like this:
RR1 S5 C92
This a rural route address for out-of-town mail delivery: Rural Route, Site, Compartment. Each letter is followed by a number and a space. Usually one to three digits long, but you never know how many numbers it could be! If the user is lazy, they may have entered zero, one or many...
Hi,
My company has a series of websites with very similar domain names based on the city. The format for these is http://locksmithdallas.com or http://locksmithgarland.com. I'd like to figure out a way to interpret Dallas and Garland out of the domain names in php. I'm a noob at regex, so I could really use some help!
...
I am trying to learn regex. I had the string:
$x = "5ft2inches";
How can I only read [5,2] into an array using regex?
Thanks
...
The language is Ruby, here is my irb session
expr = /\Aselect from (\D+)(?: (?:where|&&) (\D+) (\S+) (\S+))*(?: order by (\D+) (asc|desc))?\Z/
=> /\Aselect from (\D+)(?: (?:where|&&) (\D+) (\S+) (\S+))*(?: order by (\D+) (asc|desc))?\Z/
/> str = "select from Entity order by value desc"
=> "select from Entity order by value desc"
/> ex...
I have created a regular expression with re-builder in Emacs. I use C-c C-w to copy it to the kill-ring.
The kill-ring shows:
"\\(defun\\)"
First, I modified the copy function to get rid of the "".
\\(defun\\)
My other problem is, the regex in the kill-ring contains double backslashes, rendering it unusable for functions like query...
I'm being lazy tonight and don't want to figure this one out. I need a regex to match 'jeremy.miller' and 'scottgu' from the following inputs:
http://codebetter.com/blogs/jeremy.miller/archive/2009/08/26/talking-about-storyteller-and-executable-requirements-on-elegant-code.aspx
http://weblogs.asp.net/scottgu/archive/2009/08/25/clean-we...
i have html page with link like /with_us.php?page=digit and out.php?i=digit . how can i get all this links from page, but it will be better if i can collect immediately only digits from this links
...
I have a string like this:
var str="<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><title></title></head><body><table><tr><td style="color:#FF0000">demo1</td><td style="color:#FF0000">demo2</td></tr></table></body></html>";
I have to get the contents inside all td elements alone using regular expression in ...
Can you guys help me figure this out? I have the following JavaScript snippet:
pattern = new RegExp('^bla*a', 'i');
console.debug(pattern.exec('blatr'));
After I run this, the output is ["bla"].
The way I interpret this regular expression is this: find me a string that starts with 'bla' and ends with 'a', with as many characters in be...
Hi,
I'm trying to match a sequence of text with backslashed in it, like a windows path.
Now, when I match with regexp in python, it gets the match, but the module interprets all backslashes followed by a valid escape char (i.e. t) as an escape sequence, which is not what I want.
How do I get it not to do that?
Thanks
/m
EDIT:
well, ...
I want to split a string like this:
abc//def//ghi
into a part before and after the first occurrence of //:
a: abc
b: //def//ghi
I'm currently using this regex:
(?<a>.*?)(?<b>//.*)
Which works fine so far.
However, sometimes the // is missing in the source string and obviously the regex fails to match. How is it possible to make...
If I have:
Some text
More text
Even more text
What is the more elegant way to obtain:
Some text
More text
Even more text
All with knowing the number of repeated tokens
...
I'm trying to update a series of xml files by changing names that they reference. I have a table of names that have changed, column for the current name and a column for the name to replace with.
I looked for ways to script search and replace and found sed. It seemed like a good choice until I ran my first attempt. On inspecting the fi...
I'm trying to set the credit card numbers based on the standard check parameters but am finding lots of UK cards (Maestro / Visa Debit / Barclaycard Connect) have start numbers that dont meet other card validation script regexes;
I.e Maestro (Switch) cards are still around and start with a 4, using alot of the regex's online this would...
I want to replace
! = change
@ = static(does not)
$ = Want to replace
I got a sting like this @!$!
How do I replace the $ with something else?
EDIT: I need to use Regex as the string may appear anywhere!
...