Hi,
It has a been a long day but I cannot seem to choose in my own head which is better or if I should use both.
Basically what should I use to sanitize user inputted values. Is it either the htmlentities or preg_match function ?
I will then if the value goes into a sql query use the mysql_real_escape_string function but only until I...
Hi.
I want to parse a css file and multiply each pixel value by (2/3). I was wondering if this was possible with sed? I know this is incorrect syntax but i think it'll bring home the explanation of what i want to achieve:
sed -e "s|\([0-9]*\)px|int((\1 * 2)/3)|g" file.css
So basically I want to take \1, multiply it by (2/3) and cas...
Who can help me to translate this XML Schema pattern "[0-9]+-([0-9]|K)" to java regular expression?
...
If a user types a really long string it doesn't move onto a 2nd line and will break a page on my site. How do I take that string and remove it completely if it's not a URL?
...
RegularExpressionValidator.ValidationExpression="\d{10}" means only digits - 10 max.
RegularExpressionValidator.ValidationExpression="\d{10,12}" means only digits - 10, 11 or 12.
How to force strictly 10 or 12 symbols?
...
I'm trying to find a quick and easy way to validate some inputs with jquery. I just need to make sure that a field excepts only numerical values and only 4 integers long, basically a year.
I want to do this with jquery and can't find just a simple solution. I'm guessing you use filter?
$(document).ready(function() $(input#year).fil...
Im not sure how I can achieve this match expression. Currently I am using,
([A-Za-z0-9-]+)
...which matches letters and numbers. I would also like to match on dashes and underscores in the same expression. Anyone know how?
I would like to be able to match product_name and product-name
Thanks!
George
...
Are there common patterns that people often use regex for (Java flavor) that is usually:
incorrect due to various corner cases (but works "most of the time")
correct but very slow
etc...
Also, more generally, what other tips are there for people who use regex-es in Java? I find that I often struggle due to:
lack of named capturing ...
I am sending a var to Flash:
// incoming
var pageColor:String = "rgb(81, 89, 112)";
I have this function to covert the RGB values to a HEX
function rgb2hex(r:Number, g:Number, b:Number) {
return '0x'+(r << 16 | g << 8 | b).toString(16).toUpperCase();
}
// trace(rgb2hex(81, 89, 112));
Now I am looking for the best way to extract...
Is there any way to find out what was substituted for (the "old" text) after applying the s/// operator? I tried doing:
if (s/(\w+)/new/) {
my $oldTxt = $1;
# ...
}
But that doesn't work. $1 is undefined.
...
If I have a simple table where the data is such that the rows contains strings like:
/abc/123/gyh/tgf/345/6yh/5er
In SQL, how can I select out the data between the 5th and 6th slash? Every row I have is simply data inside front-slashes, and I will only want to select all of the characters between slash 5 and 6.
...
Why is it that JSLint returns a 'Bad escapement' on the following JavaScript line ?
param = param.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
From JSLint documentation I thought that this would be ok since the regex literal is preceeded by a parenthesis:
Regular expressions are written in a
terse and cryptic notation. JSLint ...
I have a log function on my admin panel that checks user input for being correct and, if not correct, writes it to a log file. This log file is written to the admin when logged in.
I was testing my site for vulnerabilities, and I managed to fully exploit my server using an XSS hole. I tried to filter logged input by checking the input t...
Is it possible to make use of Visual Studio 2005/2008 "Find" and "Replace" functionality along with regular expression to replace multiple lines of already coded C# code into a single line of code?
Note that Visual Studio's "Find" and "Replace" regular expression syntax differs from .NET Framework.
...
some text I want to capture. <tag> junk I don't care about</tag> more stuff I want.
Is there a easy way to write a regex that captures the first and third sentences in one capture?
...
Hi,
I have a longer text and some keywords. I want to highlight these keywords in my text. That is no problem with this code:
private static string HighlightKeywords2(string keywords, string text)
{
// Swap out the ,<space> for pipes and add the braces
Regex r = new Regex(@", ?");
key...
consider the following code:
perl -wne 'chomp;print if m/[^(?:test)]/'
I was surprised to see that grouping inside a character class works, How does this differ from (?!pattern)?
...
so if i have the text:
"this is going to be really great"
and i have the needle "goi"
i want it to find going and then replace it with the link
<a href="http://wwww.something.com/going">going</a>
can you help me? i am really bad in regex
...
What does (?<=x) mean in regex?
By the way, I have read the manual here.
...
I'd like to highlight long sentences (say, 50 words or greater) contained in an array of paragraph objects on a page, ie $("#content p"). I'm not sure how to tackle this.
I originally tried to highlight all sentences, but ran in trouble when they contained HTML tags (example highlighting code on the net seem to be for individual words o...