Regular expressions (often shortened to "regex") are a declarative language used for pattern matching within strings. Please also include a tag specifying the programming language or tool you are using.
1
vote
0answers
37 views
Finding the largest resolution from set of resolution [on hold]
I have set of strings like the following:
1024 x 768
1280 x 960
1280 x 1024
1280 x 800 widescreen
1440 x 900 widescreen
1680 x 1050 widescreen
How to I discover the largest ...
0
votes
0answers
12 views
PHP regex code to extract FDF data
I am trying to parse a FDF file using PHP, and regex. But I just cant get my head around regex, am am stuck parsing the file to generate a array
%FDF-1.2
%âãÏÓ
1 0 obj
<<
/FDF
<<
...
0
votes
1answer
21 views
How do you modify the matched string using Regex.Replace?
Say I want to convert these strings:
www.myexample.com and http://www.myexample.com
into:
<a href='http://www.myexample.com'>http://www.myexample.com</a>
using Regex.Replace
I've ...
1
vote
1answer
23 views
Regex to match this
I'm trying to capture from PHPUnit output the file path and the error line with a condition.
I don't want want lines that contain the whole word exception (can I exclude multiple words?).
This is ...
1
vote
2answers
31 views
Regex : Replace ; from word if word does not start with &
I'm trying to use Regex in javascript. Lets take this scenario,
str = "This; is; John; & Jane;"
The result I need,
str= "This* is* John* & Jane*"
This is what I have tried,
...
0
votes
1answer
26 views
PHP: preg_replace() regex syntaxis for {if …}{/endif}…{if …}{/endif}
I already have next code:
echo preg_replace(
'/\{if\s+(.+)\s?\}\s?(.+)(?=\s?\{\/endif\})\s?\{\/endif\}/s',
'"; if(\1){ $output .="\2";} $output .= "',
'{if a1 == b1}asd1{/endif} asd3c'
);
It ...
1
vote
1answer
59 views
RegEx to match the patterns
I've got a requirement
.domain
.domain.com
.domain.com/path
.domain.com:443/path
domain.com
domain.com/path
domain.com:443/path
domain
/path
:443/path
Should all be true
However
.
./path
.:443
...
-2
votes
0answers
42 views
Replacing numbers R regular-expression
I am trying to code up an html tagging tool for my code in R and I am having difficulty finding and replace numbers with colored numbers.
I think the following is in the right direction but I am not ...
3
votes
3answers
73 views
Any difference between returning False or True first?
I have the following function.
I can run it to test if true, or else false or vice versa as shown.
$fname=$_POST['fname'];
$lname=$_POST['lname'];
function namecheck ($fname,$lname)
{
...
0
votes
0answers
37 views
Script for downloading videos from YouTube
I am trying to write a script for downloading videos from YouTube playlist. For converting YouTube link to downloadable link I have some lines of code from the video Youtube Downloader Apps in 10 ...
1
vote
1answer
28 views
remove the lines from RichtextBox?
I have a richTextBox and has more than 50 lines... I like to remove the lines has MOVE STORAGE .. For example below first line of words (in the richtextbox has actually two lines) with ending semi ...
1
vote
2answers
28 views
How to match the pattern regardless of the number of whitespaces
Not good in regexp, how can i match the pattern regardless of how many whitespaces there is?
var pattern = / void main$/; //here
var pool1 = "abdodfo void main";
var pool2 = "abdodfo void ...
0
votes
2answers
19 views
IP Regex w/ further checking
I have a simple IP Regex for my Minecraft Bukkit server that will listen on players talking in chat, and if the chat message contains a valid IPv4 address will replace it with my servers IP. Obviously ...
0
votes
2answers
42 views
RegEx Escaping Comma
How do I escape the following regular expression?
Match match = Regex.Match(response.Content, @"([0-9]+)","display");
I've tried escaping the double quotes, but the comma is causing VS to think ...
2
votes
1answer
25 views
Capturing consecutive non-alphanumeric characters in a string in a single group
I want to replace all special characters in a string with dashes. I use the following regex to replace the characters.
var x = "Querty(&)keypad";
alert(x.replace(/[^A-Za-z0-9]/g, "-"));
...