Hi everybody. I'm trying to setup some small layout - template framework in php - and everything is going smooth except one thing - url rewriting.
I suck at regexp, and I suck even worse at mod_rewrite. And I'm in kinda hurry to get this stuff out, so can you please help me?
I need one .htaccess file that has just two rules
Every ...
I have a large quantity of partial HTML stored in a CMS database.
I'm looking for a way to go through the HTML and find any <a></a> tags that don't have a title and add a title to them based on the contents of the tags.
So if I had <a href="somepage">some text</a> I'd like to modify the tag to look like:
<a title="some text" href="som...
I have a block of text from which I want to extract the valid e-mail addresses and put them into an array. So far I have...
$string = file_get_contents("example.txt"); // Load text file contents
$matches = array(); //create array
$pattern = '/[A-Za-z0-9_-]+@[A-Za-z0-9_-]+\.([A-Za-z0-9_-][A-Za-z0-9_]+)/'; //regex for pattern o...
Hi guys,
Could you help me to understand what is wrong. I have usual SQL query :
var SQL = "SELECT [Extent1].[RouteID] AS [RouteID]
FROM [RoutesEntities].[Routes] AS [Extent1]\r\n
INNER JOIN [dbo].[Locales] AS [Extent2]
ON [Extent2].[LocaleID] = [Extent1].[LocaleID]";
And i need to define location ...
The following python script allows me to scrape email addresses from a given file using regular expressions.
I'm trying to add phone numbers to the regular expression also. I created this regex and seems to work on 7 and 10 digit numbers:
(\d{3}[-\.\s]??\d{3}[-\.\s]??\d{4}|\(\d{3}\)\s*\d{3}[-\.\s]??\d{4}|\d{3}[-\.\s]??\d{4})
Can this...
I've heard lots of talk about "Regex"es. I know that stands for "Regular Expression" but I'd like to learn more.
1) Is an expression a section of code?
2) If so how does this differ from other code?
3) Why is it called an expression?
4) What makes a section of code an expression?
5) Are there irregular expressions?
...
Although this question is about JFlex, it probably applies to other scanner generators such as lex, gnu-flex as well.
If I have some rule, how can I create a capturing group in part of that rule and use the result of that captured group as an argument to the code that gets called upon the rule matching?
For example, let's say I had a s...
I'm looking to do something like:
var a = "This is an A B pattern: ABABA";
a.replace("A", "B");
a.replace("B", "A");
and have it return:
=> "This is an B A pattern: BABAB"
instead of:
=> "This is an A A pattern: AAAAA"
My first thought is to do something like:
a.replace("A", "improbablePattern");
a.replace("B",...
ex:
if we have a string s1="abcde" s2="abd"
find the occurrences of "ad" in s1,s2.. here the occurrence count is 2 on the whole..
Can any1 help me regarding the regex code in java... pls..
...
Hello, I try to use regexp in .net to find and replace strings with certain token, example
myString = "this is a example of my text that I want to change <#somevalue#> and <#anothervalue#>"
How I can find the text with tokens between "<#" and "#>" and for each of those, do something to replace it (search on a database and replace any o...
I'm trying to basically extract the ?v= (the query part) of the youtube.com url... it's to automatically embed the video when someone types in a youtube.com URI (i.e. someone will type in http://www.youtube.com/?v=xyz, this program should embed it into the page automatically).
Anyway when I run the following code, I get two QUERY(ies) f...
Here is a sentence like this:
Happy birthday!! I have a good day. :)
I want to know how to process these sentence using regular expression to the following formate:
Happy birthday! I have a good day.
...
I need to parse through a file(built from a string) searching for occurences of a single or multiline text. Will this solution always work ? If not - how should I change it ?
private int parseString(String s){
Pattern p = Pattern.compile(searchableText);
Matcher m = p.matcher(s);
int count = 0;
while(m.find()) {
...
How do I match a regex where a line break can happen anywhere?
For example, if I am trying to match "thousands of turtle eggs", it should match all the following cases. (or even the cases when line breaks are inside the words.)
Scientists have revealed that a mammoth effort to move *thousands of turtle eggs* from beaches around the Gul...
i have some strings with this pattern in some files:
domain.com/page-10
domain.com/page-15
....
and i want to replace them with something like
domain.com/apple-10.html
domain.com/apple-15.html
i have found that i can use sed command to replace them at a time but because after the numbers should something be added i guess i have ...
i'm test a regular expression,i curious about the match result,
the symbol * is greendy,in my option,the result shuld only match 1 result,
like belows:
<script language=javascript>
ati('#', '../../../UpLoadFile/Product/20101010162153846.jpg', '加厚青色围脖');
}
</script>
<script language=javascript>
ati
but the result is not what i expect...
Valid: abc abc11
Invalid: 11 a-b a&&b a << b a&b a->b
...
Hi,
Is there a tool, you know of, which can taken in a python regular expression and convert it to an mx.TextTools Tag table?
Would you benefit from such a tool?
...
At the moment I'm using this regex to extract the video id from a Youtube URL:
url.match(/v=([^&]*)/)[1]
How can I alter this so that it will also get the video id from this Youtube URL, which has no v parameter:
http://www.youtube.com/user/SHAYTARDS#p/u/9/Xc81AajGUMU
Thanks for reading.
EDIT: I'm using ruby 1.8.7
...
Valid:
((int)10)
(int)10
((char)((x+y)&1))
((int *)1)
Invalid:
(a-b)
(a&=b)
a
((a))
...