^.+\\(.*\\)
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 want to verify that the HTML tags present in a source string are also present in a target string.
For example:
>> source = '<em>Hello</em><label>What's your name</label>'
>> verify_target(’<em>Hi</em><label>My name is Jim</label>')
True
>> verify_target('<label>My name is Jim</label><em>Hi</em>')
True
>> verify_target('<em>Hi<label>My name is Jim</label></em>')
False
I have a simple requirement to extract text in html. Suppose the html is
<h1>hello</h1> ... <img moduleType="calendar" /> ...<h2>bye</h2>
I want to convert it into three parts
<h1>hello</h1>
<img moduleType="calendar" />
<h2>bye</h2>
The aim is to extract text in two categories, simple html and special tags with <img moduleType="Calender".
How can I find as many date patterns as possible from a text file by python? The date pattern is defined as:
dd mmm yyyy
^ ^
| |
+---+--- spaces
where:
dd is a two digit number
mmm is three-character English month name (e.g. Jan, Mar, Dec)
yyyy is four digit year
there are two spaces as separators
Thanks!
Hi I have this code, I want it to remove all the double spaces from a text area, but it will only remove the first occurrence each time.
$(document).ready(function(){
$("#article").blur(function(){
///alert($(this).val());
$(this).val($(this).val().replace(/\s\s+/, ' '));
});
});
I've also tried removeAll(), but it won't work at all. any help would be great, thanks.
I have a live example online at http://jsbin.com/ogasu/2/edit
The following code works:
String str= "test with foo hoo";
Pattern pattern = Pattern.compile("foo");
Matcher matcher = pattern.matcher(str);
if(matcher.find()) { ... }
But this example does not:
if(Pattern.matches("foo", str)) { ... }
And neither this version:
if(str.matches("foo")) { ... }
In the real code, str is a chunk of text with multiple lines if that is treated differently by the matcher, also in the real code, replace will be used to replace a string of text.
Anyway, it is strange that it works in the first version but not the other two versions.
Hi,
I would like to understand what the following code is doing. This logic is part of a routine to strip out html from the body of an email message.
mBBSREgEx.IgnoreCase = True
mBBSREgEx.Global = True
mBBSREgEx.Pattern = "<[^>]*>"
sResult = mBBSREgEx.Replace(sResult, "")
Thank you,
Jim
This is my test-string:
<img rel="{objectid:498,newobject:1,fileid:338}" width="80" height="60" align="left" src="../../../../files/jpg1/Desert1.jpg" alt="" />
I want to get each of the JSON formed Elements inbetween the rel attribute.
It's working for the first element (objectid).
Here is my ReqEx, which works fine:
(?<=(rel="\{objectid:))\d+(?=[,|\}])
But i want to do somthing like this, which doesn't work:
(?<=(rel="\{.*objectid:))\d+(?=[,|\}])
So i can parse every element of the search string.
I'm using Java-ReqEx
I need to validate the contents of a C# method.
I do not care about syntax errors.
I do care about characters that will invalidate parsing of the rest of the code. For example:
method()
{
/* valid comment */
/* <-- bad
for (i..) {
}
for (i..) { <-- bad
}
I need to validate/fix any non-paired characters.
This includeds /* */, { }, and maybe others.
How should I go about this?
Hello,
Im trying to find a regular expression that matches this kind of URL:
http://sub.domain.com/selector/F/13/K/100546/sampletext/654654/K/sampletext_sampletext.html
and dont match this:
http://sub.domain.com/selector/F/13/K/10546/sampletext/5987/K/sample/K/101/sample_text.html
only if the number of /K/ is minimum 1 and maximum 2 (something with a quantifier like {1,2})
Until this moment i have the following regexp:
http://sub\.domain\.com/selector/F/[0-9]{1,2}/[a-z0-9_-]+/
Now i would need a hand to add any kind of condition like:
Match this if in the text appears the /K/ from 1 to 2 times at most.
Thanks in advance.
Best Regards.
Josema
Hi,
could please anybody tell me what is wrong with this regexp ?
((?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))\\:([0-9]{2,5})
for matching this: assfasfas192.168.1.1:8080192.168.222.43:8286
I need 192.168.1.1 and 8080 to be captured groups
Thank you
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 * and # can be mixed.
I tried the following expression (and variations of it): /\s([*#]{1,}) ([\S ]+)\s/si
But it doesn't seem to want to work.
What am I doing wrong? Or is there a better way of accomplishing this?
Why do PHP regexes have the surrounding delimiters? It seems like it would be more clear if any pattern modifiers were passed in as a parameter to whatever function was being used.
I need to validate a username in php, it can be:
Letters (upper and lower case)
Numbers
Any of these symbols :.,?!@
up to 15 characters OR 16 if the last character is one of the following #$^ (it can also be 15 or less with one of these 3 characters at the end only)
How do I do this?
Hi Everyone,
i'm just a begginer in perl, and very urgently need to prepare a small script that takes top 3 things from an xml file and puts them in a new one.
Here's an example of an xml file:
<article>
{lot of other stuff here}
</article>
<article>
{lot of other stuff here}
</article>
<article>
{lot of other stuff here}
</article>
<article>
{lot of other stuff here}
</article>
What i'd like to do is to get first 3 items along with all the tags in between and put it into another file.
Thanks for all the help in advance
regards
peter
How can I do this with the JS replace() method:
Make \n\n change to <p>$1</p>
Change single \n to <br>
Then back again. I think I have this part, see the JS at the bottom.
Example HTML:
<p>Hello</p><p>Wor<br>ld</p>
The <textarea> would look like:
Hello
Wor
ld
So, how can I achieve this? It's an AJAX form where when you click on this div it changes to a <textarea> and back, and fourth, etc. So, I need to it to go from <p>s and <br>s to \n\n and \n. For the going to <textarea> from HTML I have:
$(this).html().replace(/\s?<\/?(p|br\s?\/?)>\s?/g,"\n")
Regular expressions have always been my pet peeves. Every time I think that I finally got it I have a new problem !
I want to catch url like this :
http://www.mydomain.com/boutique/blabla-1/bla-bla2/99/104
http://www.mydomain.com/boutique/blabla1/99
and eventually :
http://www.mydomain.com/boutique/blabla-1/bla-bla2/product1/99/104/55/
after a lot of tries and errors I came up with this which seems to work with http://www.gskinner.com/RegExr/ but not in apache
^.*/boutique/([a-zA-Z-]*)(/?[a-zA-Z-]*)/?([0-9]*)/?([0-9]*)/?$ boutique.php?c1=$3&c2=$4
(I was only working with the first two url so far)
MY apache rewrite log debug files are helpless :
pass through /Users/iko/Sites/mysite/boutique.php
I'm only interrested in getting the ids. Any help we'll be welcomed !
Thank you.
<th>Prêmio</th>
<td colspan="11">
<div class="res"><img class="r1" src="img/x.gif" alt="Madeira" title="Madeira" />215 | <img class="r2" src="img/x.gif" alt="Barro" title="Barro" />193 | <img class="r3" src="img/x.gif" alt="Ferro" title="Ferro" />192 | <img class="r4" src="img/x.gif" alt="Cereal" title="Cereal" />202</div><div class="carry"><img class="car" src="img/x.gif" alt="carregamento" title="carregamento" />802/1800</div></td></tr></tbody></table><table cellpadding="1" cellspacing="1" class="defender">
<thead>
<tr>
i'm trying to get "802/1800", but it's driving me insane. if I use:
var myregexp = /title="carregamento"/;
it works
but going to the next step which is:
var myregexp = /title="carregamento" \/>/
already returs me null.
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:
"aß aß? ?aß aß aß".replace(/\baß\b/g, "AB");
the word boundary operator doesn't seem to work:
"aß aß? ?aß aß aß"
Is there a solution to this?
Here is the code :
> var reg = new RegExp(" hel.lo ", 'g');
>
> var str = " helalo helblo helclo heldlo ";
>
> var mat = str.match(reg);
>
> alert(mat);
It alerts "helalo, helclo", but i expect it to be "helalo, helblo, helclo, heldlo" .
Only the half of them matches, I guess that's because of the space wich count only once. So I tried to double every space before processing, but in some case it's not enough.
I'm looking for an explanation, and a solution.
Thx
Hi,
I am looking for a regular expression for c# asp.net 3.5 that will fail if there are ever any double spaces in a sentence or group of words.
the cat chased the dog = true
the cat chased the dog = false (doubles spaces occur at random intervals)
thanks
I have a CSV file I need to clean up. This is a one-time thing so I'd like to do it in Notepad++ if possible.
The CSV file has two fields, one of which is wrapped in quotes. I'd like to remove any Carriage Returns from within the quoted field. I was trying to use this pattern but can't get it quite right...
(.*)\"(.*)\n(.*)\"(.*)
Also correct me if I am wrong, but I presume the "replace with" value would be something along the lines of:
\1\2\3\4
Thanks in advance.
I'm also open to alternate solutions such as a quick and dirty PERL script.
<table >
<tr>
<td colspan="2" style="height: 14px">
tdtext1
<a>hyperlinktext1<a/>
</td>
</tr>
<tr>
<td>
tdtext2
</td>
<td>
<span>spantext1</span>
</td>
</tr>
</table>
This is my sample text how to write a regular expression in C# to get the matches for the innertext for td, span, hyperlinks.
Thanks everyone.