i need to parse all urls from a paragraph(string)
eg.
"check out this site google.com and don't forget to see this too bing.com/maps"
it should return "google.com and bing.com/maps"
i'm currently using this and its not to perfection.
reMatch("(^|\s)[^\s@]+\.[^\s@\?\/]{2,5}((\?|\/)\S*)?",mystring)
thanks
...
So i'm writing a quick perl script that cleans up some HTML code and runs it through a html -> pdf program. I want to lose as little information as possible, so I'd like to extend my textareas to fit all the text that is currently in them. This means, in my case, setting the number of rows to a calculated value based on the value of the ...
Is it possible to simulate re.findall in the pexpect module?
I currently have a script that ssh's into a server using pexpect. I then have it send a command to the server which returns a bunch of lines in p.before (p being a pexpect spawn):
JUNK JUNK JUNK IP ADDRESS 10.0.0.1 JUNK JUNK
JUNK IP ADDRESS 10.0.0.3 JUNK JUNK JUNK
JUNK JUNK J...
Hi,
I'm trying to set validation for an image alternate text, and here's what I think should be validated so far. It's a pretty simple RegEx, but I'm yet to start learning that topic..
Double quotes
< and > characters to prevent HTML input
Is there anything else you would add to this?
Would text length ever be an issue?
I apprecia...
I am trying to parse an output of about a hundred lines. The format of this output is as such:
<random text> STATION "STATION_NAME_ONE": <random text>
<random text> IP Address: 0.0.0.0 <random text>
<SEVERAL LINES OF RANDOM TEXT>
<random text> STATION "STATION_NAME_TWO": <random text>
<random text> IP Address: 1.1.1.1 <random text>
<SE...
I'm working on a project that requires me to read values from a file and manipulate them slightly before storing them elsewhere. One of the things I need to do is convert some dates from mm/dd/yy format to mm/dd/yyyy format. Unfortunately for me, I am relatively new to PHP and regular expressions (which I assume is one of the better ways...
I am trying to take a string of text and create an array from it so that the string:
var someText='I am some text and check this out! http://blah.tld/foo/bar Oh yeah! look at this too: http://foobar.baz';
insert magical regex here and
the array would look like this:
theArray[0]='I am some text and check this out! '
theArray[1]='h...
Hi everyone,
Usually, regular expression works for ASCII code. Say "abbbd".match("ab*d").
I wonder if there exist algorithms or tools that allow user to match regular expression
for integer lists.
e.g:
int[] a = {1,2,2,2,2,5};
a.match("12*5");
Thank you so much.
...
Can anyone explain me, step by step, why the regex fails with this:
<.++>
with this string to compare: <em>
The same string is found with lazy or greedy quantifiers but in this case
what steps are involved?
I use Java regex flavor.
...
i have a htaccess file for redirection
the redirected content is
RewriteCond %{REQUEST_FILENAME} -location&action=photos&page=$
RewriteRule ^(.*)$ /sitename/view.php?link=$1&action=photos&page=&1
[L,QSA]
The page numer is dynamically passing from the page
How we can get the page number here pls helpme
...
I'm trying to create a rewrite rule to match data-2, data-3, data-4 etc. and send them to data.php?var=2. It needs to ignore data-1.
RewriteRule ^data-([2-9])/?$ index.php?page=data&var=$1 [NC,L]
The above rule works for numbers 2-9, but how can I make it so that it works for any number greater than 1?
...
How can I match "Because it already exists" with regex in string below :
<faultstring>Error has occured! Reason why: Because it already exists. request id: 443p3-34356a</faultstring>
This expressio fails :
(.+)+Because it already exists(.+)+
I need to match <faultstring></faultstring> as well, so I need to match Because it already...
Ok, I think I overcomplicated things and now I'm lost. Basically, I need to translate this, from Perl to Lua:
my $mem;
my $memfree;
open(FILE, 'proc/meminfo');
while (<FILE>)
{
if (m/MemTotal/)
{
$mem = $_;
$mem =~ s/.*:(.*)/$1/;
}
}
close(FILE);
So far I've written this:
for Line in io.lines("/proc/memin...
Hi,
I want to extract last character of a string. In fact I should make clear with example. Following is the string from which i want to extract:
<spara h-align="right" bgcolor="none" type="verse" id="1" pnum="1">
<line>
<emphasis type="italic">Approaches to Teaching and Learning</emphasis>
</line>
</spara>
In the ...
Hi, i have this js code :
var str = "javascript:__doPostBack('ctl00$M$List$_rli2$ctl06','')";
alert (str);
var str = str.replace(/\$_rli\d+/, "$_rli" + 7);
alert (str);
And in IE it produces me result as follows:
javascript:__doPostBack('ctl00$M$Listjavascript:__doPostBack('ctl00$M$List$_rli2$ctl06','')rli7$ctl06','')
while it s...
Hello Good people
i'm developing a WPF (.NET 3.5) application where i need to validate atextbox with a regular expression to match Empty textbox or text like 02145 or 05145 or 02145,05879,02445. the expression i use is ^(0(2|5)[0-9]{3})?((,0(2|5)[0-9]{3})*?)$.
It almost works just that i won't let me have empty textbox. here is som...
Hi,
Is there a good way to convert Regular Expression into LIKE inside a Function (MSSQL)?
The sproc does not get more complicated than this:
(country\=)(?<Country>[\w\d]+)(\&sessionid\=)(?<SessionId>.+)
The groups will not be used in the LIKE, they are there for another purpose.
I would like to use this inside a sproc late like:
...
Hey guys,
has VBA any good mechanism for checking, if the content of a given Excel Cell matches a specific regex?
In my case i want to know, if some cell has the format
m
m2
m1234
In fact, there's just one defined letter at the beginning, followed by a not specified amount of numbers.
How do I put this into an If-Else construct?
I...
I know there are a ton of regex examples on how to match certain phone number types. For my example I just want to allow numbers and a few special characters. I am again having trouble achieving this.
Phone numbers that should be allowed could take these forms
5555555555
555-555-5555
(555)5555555
(555)-555-5555
(555)555-5555 and so on...
I need a pattern (java regex) that will match international mobile numbers containing 7 to 17 digits with the exception that the first 3 digits can not be (965) consecutively.
Thanks in advance.
...