I need to find a regular expression which pulls out a value from a table cell in a html doc.
Example contents of this table cell are "Result: 40 mins".
I need a regular expression to match the actual number (40).
This is in java, thanks in advance.
...
codes = new Vector<String>();
titles = new Vector<String>();
urls = new Vector<String>();
lecturers = new Vector<String>();
while (m.find()) {
String courseCode = m.group(1);
String courseTitle = m.group(2);
String courseURL = url;
String lecturerName = m.group(4);
codes.add(courseCode);
titles.add(courseTitl...
I have the following password requirements:
1) Should be 6-15 characters in length
2) Should have atleast one lowercase character
3) Should have atleast one uppercase character
4) Should have atleast one number
5) Should have atleast one special character
6) Should not have spaces
Can anyone suggest me a RegEx for this requirement?
...
could someone help me with the regex pattern that i could use to match the text "Cats" within the link element?
<A HREF="http://www.catingale2?subject=10023">Cats</A> forum
Thanks in advance!
...
I am attempting (and failing) to write a PHP regex that will match a Windows product key in the form XXXXX-XXXXX-XXXXX-XXXXX-XXXXX (where X is an uppercase letter or a number).
I have come up with the following, but it is not doing quite what I expect (provided it actually can do what I expect!). I consider myself pretty well versed in ...
I want to display a specific message based on the URL request on a JSP.
the request URL can be:
/app/cars/{id}
OR
/app/people/{id}
On my messages.properties I've got:
events.action.cars=My car {0} event
events.action.people=My person {1} event
Finally, on my JSP page I want to have the following code:
<spring:message code="ev...
I Have a question about finding html tags using Java and Regex.
I am using the code below to find all the tags in HTML, documentURL is obviously the HTML content.
The find method return true, meaning that it can find something in the HTML but the matches() method always return false and I am completly and utterly puzzled about this.
I...
I need a rewriterule so if i type index.html i will show index.php
I mean i have files like, home.php, about.php and i want to be able to access them with .html too
Thanks in advance
...
I need a clean and simple script that can find and remove all event attributes from all html tags in a string. The "on..." attributes that is - onclick, onkeyup etc.
EDIT: Here's how they do it in Kohana:
$string = preg_replace('#(<[^>]+?[\x00-\x20"\'])(?:on|xmlns)[^>]*+>#iu', '$1>', $string);
EDIT: Here's how they do it in CodeIgnit...
I thought that by default my Regex would exhibit the greedy behavior that I want, but it is not in the following code:
Regex keywords = new Regex(@"in|int|into|internal|interface");
var targets = keywords.ToString().Split('|');
foreach (string t in targets)
{
Match match = keywords.Match(t);
Console.WriteLine("Matched {0,...
How can I use sed to replace this line
char * path_list_[1] = { "/some/random/path" };
with this line
char * path_list_[2] = { "lib/foo", "lib/bar" };
in a file named source.c
Notes:
* The path is really random.
* Your solution should only change this line in source.c
* I'm only interested in a sed oneliner.
You can use this Pyth...
Hi guys,
I am new to stackoverflow (my first post) and regex.
Currently i am working on a simple dirty app to replace baseclass properties with ctor injected fields. (cos i need to edit about 400 files)
It should find this:
ClassName(WiredObjectRegistry registry) : base(registry)
{
and replace with:
ClassName(IDependency paramName,...
I have a paragraph of text below that I want to use an input source. And I want the doSpin() function to take the stream of text and pick one value at random, from each [%group of replacement candidates%].
This [%should|ought|would|could%] make
it much [%more
convenient|faster|easier%] and help
reduce duplicate content.
So th...
In my program, I have a string (obtained from an external library) which doesn't match any regular expression.
String content = // extract text from PDF
assertTrue(content.matches(".*")); // fails
assertTrue(content.contains("S P E C I A L")); // passes
assertTrue(content.matches("S P E C I A L")); // fails
Any idea what might be wron...
Hi There
I am scraping a year value from the innerhtml of a span and the value is in brackets like this:
<span class="year_type">(2009)</span><br>
I want to get the value of the year without the brackets but am getting some compiler errors when trying to escape the "(" char.
My pattern:
const string yearPattern = "<span class=\"yea...
I am attempting to scan a string of words and look for the presence of a particular word(case insensitive) in an XSLT 2.0 stylesheet using REGEX.
I have a list of words that I wish to iterate over and determine whether or not they exist within a given string.
I want to match on a word anywhere within the given text, but I do not want t...
I want to validate a registration form that accepts an email address in the following format (it's a subdomain)P
[email protected]
Actually,because there can be so many variations of emails nowadays, is there a handy regex for checking just the last part of the email e.g. .ie, or .com
GF
...
Im trying to grab the destination (dynamic) of a link (static) with php
Im not sure what the best way to do this is.
the link is
<a href=page.php?XXYYYYYYY>LinkName</a>
the X's are letters and the Y's are numbers (both can vary in length). 'Linkname' always stays the same though.
Is regex the best option here? Or is there a better ...
Would somebody care to help me out with a regex to reliably recognize and remove any number, followed by a dot, in the beginning of a string? So that
1. Introduction
becomes
Introduction
and
1290394958595. Appendix A
becomes
Appendix A
...
Hi all,
I'm using the function preg_replace but I cannot figure out how to make it work, the function just doesn't seem to work for me.
What I'm trying to do is to convert a string into a link if any word contains the % (percentage) character.
For instance if I have the string "go to %mysite", I'd like to convert the mysite word into a...