I would like to write a regular expression in javascript to match specific text, only when it is not part of an html link, i.e.
match <a href="/link/page1">match text</a>
would not be matched, but
match text
or
<p>match text</p>
would be matched.
(The "match text" will change each time the search is run - I will use something l...
I have a lot of movies in directories with filenames containing their dimensions.
descriptor-800x600.mov
cool_animation-720p.mp4
reactor-1080p.mov
test-640x480.mov
I'm looking to pull out the 800, 600 from #1. 720 from #2, 1080 from #3, etc.
Looking for some help to tweak what I've got so far:
$re = '/^(.*?)\-(\d{3,4})p+|(\d{2,...
If I have various strings that have text followed by whitespace followed by text, how can I parse the substring beginning with the first character in the second block of text?
For example:
If I have the string:
"stringA stringB"
How can I extract the substring
"stringB"
The strings are of various lengths but will all be of...
Hi!
I am creating a small application that will open a word document, scan it for a credit card number (different patterns), replace the text, save and close the document.
My code is fairly simple:
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ...
I have the following URL: http://www.domain.com/keyword/b21?f=&ca1=50&p=1
And the RewriteRule I am trying to use is as follows:
RewriteRule ^([^.]+)/b([0-9]+)?f=([^.]+)&p=([0-9]+)$ script.php?id=$2&p=$2&filters=$3
Unfortunately this rule is not matching the URL.
I think it has something to do with the ? as i know this is a c...
We are currently migrating one of our oracle databases to UTF8 and we have found a few records that are near the 4000 byte varchar limit.
When we try and migrate these record they fail as they contain characters that become multibyte UF8 characters.
What I want to do within PL/SQL is locate these characters to see what they are and then...
Is there any way to have an expression in brackets not be caught in a group?
E.g. i have an expression something like this:
(A(B|C)?) D (E(F|G)?)
Take note of the optional blocks (B|C)? and (F|G)? needing brackets.
I'm not interested in what was caught in these groups. All i want is to catch the full first and last block.
But becaus...
Hey,
How do I a string against a regex such that it will return true if the whole string matches (not a substring)?
eg:
test( \ee\ , "street" ) #=> returns false
test( \ee\ , "ee" ) #=> returns true!
Thank you.
...
Hello!
I want to parse some C source files and find all strings ("foo").
Something like that works
String line = "myfunc(\"foo foo foo\", \"bar\");";
System.out.println(line);
String patternStr = "\\\"([^\"]+)\\\"";
Pattern pattern = Pattern.compile(patternStr);
Matcher matcher = pattern.matcher("");
String s;
if(line.matches(".*"+pat...
If I am creating a simple web scraper (from root url, grab all links, then from those links grab all emails) would it be worthwhile to use HTML Agility Pack? I am not actually looking through HTML tags, I am simply looking to scan for emails within the entire document.
Would it be more efficient to use HTML agility pack?
I am stripping...
I'm trying to build an alternative data entry, wherein the user will express some sort of command, that i'll parse. Rather than go into the details of the vocabulary I would be using in this effort here's an example of what I'm trying to accomplish with appoligies to Rex Harrison.
given the following sentences
the rain in spain fal...
I have many html documents, I need to replace the text "foo" to "bar" in all documents, except in links
For example
foo<a href="foo.com">foo</a>
should be raplaced to
bar<a href="foo.com">bar</a>
the url in the link (foo.com) should be left untouched.
The same case in image links and links to javascripts or stylesheets, only th...
var aText:String = "C:\\folder\\folder\\file";
var filterVal:String = aText.toLowerCase().replace( /\//g, '/');
trace( aText );
trace( filterVal );
results as:
C:\folder\folder\file
c:\folder\folder\file
this code was based on this site and nascent regex skills.
What am I doing wrong? Thank you.
...
I would like to write a regular expression to validate and input field against the following arguments:
field is required (cannot be
empty)
field must not be a negative number
field must be a validate decimal
number to two decimals (eg. 1 or 1.3
or 1.23)
field can be any valid number between 0 and 100 or an 'e'
...
I'm sure this is trivial, but I'm unable to create a regex that takes into account that the subject consists of multiple lines. The "m" modifier for one does not seem to work.
...
I have a long string, and I'd like to loop through it and pull out all the int values in order. This seems simple enough, but I can't seem to figure it out.
string raw = "I am a string and I have some numbers 3 45 333 2 39 inside of me 1839 9303, and I'd like to get these numbers into 9 -10 00 9e09 into a string[] or something else";
...
I am trying to build a regular expression to replace unresolved velocity variables with the syntax required by other parameterized variable frameworks such as spring jdbc and hibernate.
Essentially, I want a replacement pattern to find and replace ${a} with :a, ${b} with :b, etc.
...
I have a comment block that can look like this;
/**
* variable1: value
* variable2: value
*/
or like this;
/*
variable1: value
variable2: value
*/
What I need is to be able to match any number of variable/value pairs and add them to an array. I can't seem to figure it out though, I keep matching the wrong things.
All variables ...
I'm trying to create a textmate snippet that will transform this:
HELLO WORLD<br />
SAY ANYTHING
To this:
hello world say anything
Any help?
...
Is it possible/practical to build a single regular expression that matches hierarchical data?
For example:
<h1>Action</h1>
<h2>Title1</h2><div>data1</div>
<h2>Title2</h2><div>data2</div>
<h1>Adventure</h1>
<h2>Title3</h2><div>data3</div>
I would like to end up with matches.
"Action", "Title1", "data1"
"Action", "Title2", "data...