I have this html:
<a href="http://www.site.com/">This is the content.</a>
I just need to get rid of the anchor tag html around the content text, so that all I end up with is "This is the content".
Can I do this using Regex.Replace?
...
Hello,
I am having a strange problem and I can't seem to figure it out.
My filename is something like this:
DER 1513016-3.020F.NCF.
I want to be able to change it to:
DER 1513016-3.020H.NCF
Sometimes the filename can be this as well:
DER 1513016-3.020F_NEW.NCF
which would change to:
DER 1513016-3.020H_NEW.NCF
This is my code ...
Hi,
I am trying to match pattern like '@(a-zA-Z0-9)+ " but not like 'abc@test'.
So this is what I tried:
Pattern MY_PATTERN
= Pattern.compile("\\s@(\\w)+\\s?");
String data = "[email protected] #gogasig @jytaz @tibuage";
Matcher m = MY_PATTERN.matcher(data);
StringBuffer sb = new StringBuffer();
boolean result = m.find();
while(r...
... Foo, Bar, Wibble A, B, C2, N, J, Baz, Qux, More, More, ...
... Bar, Qux, Wibble D, E, J, N6, O, Foo, Foo, More, More, ... and so on
How do I match highlighted part of these strings using PERL-compatible regular expressions?
It starts with a word "Wibble" and continues with one or two character components separated by a com...
i have a huge .java file and i want to find all declared objects given the className. i think the declaration will always have the following signature:
className objName;
or
className objName =
or
className objName=
can someone suggest me a grep pattern which will find these signatures. I have the following (incomplete) :
...
I have a string named s_Result which will be parsed from the Internet. The format may be "Distance: 2.8km (about 9 mins)", and there are 4 variables which are f_Distance, m_DistanceUnit, f_timeEst, m_timeEstUnit.
My question is how to parse s_Result and assign 2.8, km, 9, mins into f_Distance, m_distanceUnit, f_timeEst and m_timeEstUnit...
I have this situation(Java code):
1) a string such as : "A wild adventure" should match.
2) a string with adjacent repeated words: "A wild wild adventure" shouldn't match.
With this regular expression: .* \b(\w+)\b\s*\1\b.* i can match strings containing adjacent repeated words.
How to reverse the situation i.e how to match strings w...
Hi,
I have the following:
[list]
[*] test
[*] test
[*] test
[/list]
and I would like to create a regular expression that turns that into:
<ul>
<li>test</li>
<li>test</li>
<li>test</li>
</ul>
I know regex enough to replace simple tags, but in this case I need to replace li tags only if they are contained inside ul. Is there a way t...
I'm trying to create a Regular Expression to match "wiki style" lists as in (using preg_replace_callback() ):
* List Item 1
* List Item 2
*# List Item 2.1
*# List Item 2.2
* List Item 3
Asterisks denote Unordered Lists while Number-Signs denote Ordered Lists. I'm trying to get this so it can match infinite depth and so that...
I'm trying to use regex to add a span to the first word of content for a page, however the content contains HTML so I am trying to ensure just a word gets chosen. The content changes for every page.
Current script is:
preg_match('/(<(.*?)>)*/i',$page_content,$matches);
$stripped = substr($page_content,strlen($matches[0]));
preg_match('...
What should be the regex for replacing a tr tag with a th tag for the table tag anywhere in an HTML file ?
...
Hi all,
I have this regex that allow all php files :
^.*\.([Pp][Hh][Pp])
how can I exclude a specific file, for example test.php ?
Thanks for your answer,
Best regards
[edit]
I omit to say that it is a reg from a htaccess file, the /i doesn't seems to work, and the ? neither.
[Edit2]
the purpose is to grant access to authenticated...
Hi,
In Java, on a text like foo <on> bar </on> thing <on> again</on> now, I should want a regex with groups wich give me with a find "foo", "bar", empty string, then "thing", "again", "now".
If I do (.*?)<on>(.*?)</on>(?!<on>), I get only two group (foo bar, thing again, and I've not the end "now").
if I do (.*?)<on>(.*?)</on>((?!<on>...
Hi,
I have tried to work this regex to set up a goal in GA for 2 days, but I cannot get my head around it...
The url format is like this:
/purchase.php?cDd=1&transaction_id=xxxxxxx&verify=xxxxxxxxxxxxxxxx=&method=creditcard&type=purchase
transaction_id= is populated with a sept of numbers
verify= is populated by a string of numbers, l...
In JavaScript:
"ab abc cab ab ab".replace(/\bab\b/g, "AB");
correctly gives me:
"AB abc cab AB AB"
When I use utf-8 characters though:
"αβ αβγ γαβ αβ αβ".replace(/\bαβ\b/g, "AB");
the word boundary operator doesn't seem to work:
"αβ αβγ γαβ αβ αβ"
Is there a solution to this?
...
Hi,
How can I take a line like this:
Digital Presentation (10:45), (11:30), 12:00, 12:40, 13:20, 14:00, 14:40, 15:20, 16:00, 16:40, 17:20, 18:00, 18:40, 19:20, 20:00, 20:40, 21:20, 22:00, 22:40, 23:10, 23:40.
And match all the 24 hour times so I can convert to a more human readable format using date()?
Also I want to match times in t...
Hi there!
Is there a nice way to evaluate a regular expression range, say, for a url such as
http://example.com/[a-z]/[0-9].htm
This would be converted into:
http://example.com/a/0.htm
http://example.com/a/1.htm
http://example.com/a/2.htm
...
http://example.com/a/9.htm
...
http://example.com/z/0.htm
http://example.com/z/1.htm
http:...
I'm trying to create a regex expression to match any string that has exactly 9 digits. the digits can exist anywhere in the string.
For example, if you passed in the following strings, you'd get a match:
123456789
123aeiou456abc789
These strings would fail to provide a match
12345678
1234567890
...
I have a table like:
A | 1
A | 2
B | 1
B | 2
B | 3
I'm trying to transform it to look like this:
A { 1 | 2 }
B { 1 | 2 | 3 }
I've come up with this which will match correctly I just can't figure out how to get the repeated capture out.
(A|B)|(\d)(\r\n\1|(\d))*
UPDATE
I realize that this would be fairly trivial with so...
Does anyone know of a regular expression for matching on a sequence of four digits? I need a match on ascending (1234), descending (4321), or the same (1111). This would be strictly ascending/descending; 1357 shouldn't match.
...