Is there a more 'powershelly' way of matching a single string against an array/collection of regexes other than iterating through each one in turn?
What I'd really like to be able to do is something this
$database.Name -match $includeRegexArray
Given the way Powershell works it feels like there should be a nicer solution than writing ...
I have a String of the format "[(1, 2), (2, 3), (3, 4)]", with an arbitrary number of elements. I'm trying to split it on the commas separating the coordinates, that is, to retrieve (1, 2), (2, 3), and (3, 4).
Can I do it in Java regex? I'm a complete noob but hoping Java regex is powerful enough for it. If it isn't, could you suggest a...
What I'm trying to do: remove innermost unescaped square brackets surrounding a specific, unescaped character (\ is escape)
input: [\[x\]]\]\[[\[y\]]
output when looking for brackets around y: [\[x\]]\]\[\[y\]
output when looking for brackets around x: \[x\]\]\[[\[y\]]
In short, remove only the unescaped set of brackets around the spec...
I'm attempting to run preg_match to extract the SRC attribute from the first IMG tag in an article (in this case, stored in $row->introtext).
preg_match('/\< *[img][^\>]*[src] *= *[\"\']{0,1}([^\"\']*)/i', $row->introtext, $matches);
Instead of getting something like
images/stories/otakuzoku1.jpg
from
<img src="images/stories/otak...
How to swap attributes ID and runat in all tags in my Visual Studio 2008 solution?
Was
<asp:Label ID="Label1" runat="server" />
became
<asp:Label runat="server" ID="Label1" />
...
So this is purely a question of curiosity...
Say I have a set of tags:
<tag>
<sub>A</sub>
<sub>B</sub>
<sub>C</sub>
</tag>
<tag>
<sub>1</sub>
<sub>2</sub>
<sub>3</sub>
</tag>
Is it possible to, in a single Regex.Replace command, aggregate the contents of all <sub> tags within a <tag> into one <sub>.
Like so:
<tag><sub>A...
I am trying to find all the inputs/outputs of all MATLAB functions in our internal library. I am new (first time) to regex and have been trying to use the multiline mode in Python's re library.
The MATLAB function syntax looks like:
function output = func_name(input)
where the signature can span multiple lines.
I started with a patt...
I want to store Google search results (both title and link) into database. HTML code of search results is like:
<br/>
THETITLE
And each page has 10 results. Can anyone show me how to retrieve THEURL and THETITLE?
Thank you so much!
...
how to replace 'abc' to 'a\0\0c'
the following code is fail and give output 'ac'
<?php
$input = 'abc';
$pattern = '/b/i';
$replace = "\\0\\0";
$output = preg_replace($pattern, $replace, $input);
echo $output;
?>
...
I want to be able to utilize a 'grep' or 'pcregrep -M' like solution that parses a log file that fits the following parameters:
Each log entry can be multiple lines in length
First line of log entry has the key that I want to search for
Each key appears on more then one line
So in the example below I would want to return every line t...
i have javascript variable having value
var ull="<ul><li>sunil here from mandya </li><li>kumar here</li></ul>"
i want output of alert message of each list content like below
1st alert message =sunil here from mandya
2nd alert message =kumar here
how to accomplish this with regex,please help,, i am new to this
...
I have an xml file with a list of items:
<Items
ID="1B884B58-0C47-451B-956E-44866A7F3F91"
Name="Home"
TemplateID="BD5B78E1-107E-4572-90DD-3F11F8A7534E"
MasterID="00000000-0000-0000-0000-000000000000"
ParentID="70A77564-8D3F-459E-850F-FFC79CC97B38"
Created="2009-07-17T12:18:57.247"
Updated="2009-08-14T14:08:38.970"
/>
I n...
Hi,
I would like to turn a string with opening hours like this:
"Monday-Friday>10:00-18:00;Saturday>12:00-17:00;Sunday>12:00-15:00"
Into this:
[ {:period => "Monday-Friday", :hours => "10:00-18:00"}, {:period => "Saturday", :hours => "12:00-17:00"}, {:period => "Sunday", :hours => "12:00-15:00"} ]
I'm trying it with the String.sca...
Hi Guys,
I need to setup a function to remove the first character of a string but only if it is a comma (, - Ive found the substr function but this will remove anything reagrdless of what it is.
I thinking some regex might be involved and i had a look but i cannot work it out
My current code is
text.value = newvalue.substr(1);
T...
How to find all server-side tags (<asp:) that doesn't contains attribute runat in my Visual Studio 2008 / MonoDevelop solution using grep?
...
Hi
I shall test a date string to see if it is one of these three:
dd-mm-yyyy OR yyyy OR dd-mm-yyyy/dd-mm-yyyy
I have combine these three, but the last one makes trouble since I cannot just match a single "/" using \Q/\E.
[0-9]{2}-[0-9]{2}-[0-9]{4} -> dd-mm-yyyy
[0-9]{4} ...
Hi,
I need to match some operators: =, !=, >, <, <=, >=
The string I need to match may be something like: "2=2 OR 33 >= 32 AND 3<5"
What can be the RegEx expression to match this, knowing that
- I don't want to receive a '=' match on a '<=' operator
- The operators may or may not have spaces surrounding them
Thanks in advance!
Alex
...
I want to do the following with python:
Validate if a UTF8 string is an integer.
Validate if a UTF8 string is a float.
Validate if a UTF8 string is of length(1-255).
Validate if a UTF8 string is a valid date.
I'm totally new to python and I believe this should be done with regular expression, except maybe for the last one. Your help ...
I have a rule that will get the extension of every file from the url. I need to match all jpg, gif, png and bmp files. This is for a watermark application. Currently, it only matches jpg and Jpg. Can someone help me match all four extensions?
Here is what I currently have so far.
RewriteRule ^(.*\.[jJgG].*)$ /test.php?i=$1
...
I have this code :
$count = 0;
preg_replace('/test/', 'test'. $count, $content,-1,$count);
For every replace, I obtain test0.
I would like to get test0, test1, test2 etc..
...