The text book teaches us to write regular expressions using the epsilon (ε) symbol, but how can I translate that symbol directly to code without having to completely rework my regular expression?
For instance, how would I write this regex which would catch all lowercase strings that either begin or end in a (or both).
Not 100% sure thi...
I have the next strings:
generation_1_2
generation_2_8
generation_3_12
How can I put digits from this strings in variables?
For example:
$digit1[0] is 1.
$digit1[1] is 2.
$digit1[1] is 3.
$digit1[0] is 2.
$digit1[1] is 8.
$digit1[2] is 12.
Thanks for your help.
...
Hello
Is it possible to use regular expressions with the FileGrep function in InstallShield?
If not is there some other solution to get data from web.config? I want to retrieve some information from the AppConfig, ApplicationConfig and ConnectionString sections.
...
Does someone have a regular expression that gets a link to a Youtube video (not embedded object) from (almost) all the possible ways of linking to Youtube?
I think this is a pretty common problem and I'm sure there are a lot of ways to link that.
A starting point would be:
http://www.youtube.com/watch?v=iwGFalTRHDA
http://www.youtube...
Hi all
I'm running a grep to find any *.sql file that has the word select followed by the word customerName followed by the word from. This select statement can span many lines and can contain tabs and newlines.
I've tried a few variations on the following:
$ grep -liIr --include="*.sql" --exclude-dir="\.svn*" --regexp="select[a-zA-...
I would like some help creating a regular expression for parsing a string on a textbox. I currently have these two javascript methods:
function removeIllegalCharacters(word) {
return word.replace(/[^a-zA-Z 0-9,.]/g, '');
}
$("#comment").keyup(function() {
this.value = removeIllegalCharacters(this.value);
});
I would like to rep...
Is there an awk-like or sed-like command line hack I can issue to generate a list of all keyboard characters (such as a-zA-z0-9!-*, etc)? I'm writing a simple Caesar cipher program in my intro programming class where we do the rotation not through ASCII values, but indexing into an alphabet string, something like this:
String alphabet ...
Problem
I am trying to match the hash part of a URL using Javascript. The hash will have the format
/#\/(.*)\//
This is easy to achieve using "new RegExp()" method of creating a JS regular expression, but I can't figure out how to do it using the standard format, because the two forward slashes at the end begin a comment. Is there ...
Is there a way to get first part of a String before 4 numbers in ().
Input String: "Some Title (2000) some text."
Output String: "Some Title "
I don't want to iterate over matches and get first. I want regex to get the characters before 4 numbers in () and I want it to discard the rest of the text.
...
I am trying to a regular expression which extracs the data from a string like
<B Att="text">Test</B><C>Test1</C>
The extracted output needs to be Test and Test1. This is what I have done till now:
public class HelloWorld {
public static void main(String[] args)
{
String s = "<B>Test</B>";
String reg = "<.*?>(...
Hey all,
I feel like a moron posting such simple questions on here, but the knowledge base of this site is just amazing. Thanks for your understanding.
Concerning a question about finding the minimum pumping length (concerning the pumping lemma for regular languages) of a regular expression:
Regular Expression R = 1011 (over the alph...
I am trying to match a Youtube URL with regex to see if it is valid. This is my code:
if(preg_match('\bhttp://youtube.com/watch\?v=.*\b', $link))
{
echo "matched youtube";
}
But I'm getting an error:
Warning: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash in C:\xampp\htdocs\ajax\youtube.php o...
preg_replace('/http:///ftp:///', 'https://', $value);
http:// and ftp:// inside $value should be replaced with https://
This code gives error:
preg_replace() [function.preg-replace]: Unknown modifier '/'
What is a true regex for this task?
...
I have a string of the form:
codename123
Is there a regular expression that can be used with Regex.Split() to split the alphabetic part and the numeric part into a two-element string array?
...
i need help with an Reg. Ex. i have a long text with many whitespaces and new lines, i need to find and select ALL between 2 strings.
example:
iojge test rgej <foo>
ferfe 098n34hjlrej
fefe <end
i want to find all between test and end:
rgej <foo>
ferfe 098n34hjlrej
fefe <
how can i do this?
...
Here is the regular expression that I am trying to modify:
The client only wants the user to be able to enter a maximum of 2 of the same consecutive characters.
^[a-zA-Z0-9-().\&\@\?\""#,\+\''\s\/]{7,}$
...
How do I make the expression which checks the birthday input to match a format like this dd/mm/yyyy? Below is what I came out so far, but it takes this too if I put 99/99/9999!
if (!preg_match("/[0-9]{2}\/[0-9]{2}\/[0-9]{4}/", $cnt_birthday))
{
$error = true;
echo '<error elementid="cnt_birthday" message="BIRTHDAY - Only this bi...
I'm using PHP and I have text like:
first [abc] middle [xyz] last
I need to get what's inside and outside of the brackets. Searching in StackOverflow I found a pattern to get what's inside:
preg_match_all('/\[.*?\]/', $m, $s)
Now I'd like to know the pattern to get what's outside.
Regards!
...
I'm currently working with parsing some data from SQL Server and I'm in need of help with a Regex.
I have an assembly in Sql Server 2005 that helps me Replace strings using C# Regex.Replace() Method.
I need to parse the following.
Strings:
CAD 90890
(CAD 90892)
CAD G67859
CAD 34G56
CAD 3S56.
AX CAD 89...
Here it is:
/(?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/
It only passes if the password contains upper case AND lower case letters, and also either 1 digit or 1 special character, however I want underscore _ to count as a special character as well and it currently does not, how can modify this regex so that it w...