regex

PHP Regex for different URLs

I am trying to figure out a way to match 3 different URL types, they are; http://(www.)domain.com or www.domain.com http://(www.)domain.com/image.jpg/.png/gif or www.domain.com/image.jpg/.png/.gif http://(www.)youtube.com/watch?v=Li1zXaEYol8 or www.youtube.com/watch?v=Li1zXaEYol8 Note, I do not want them parsed, if they are just doma...

Pattern Matching in Java

I'm working on java program that can compute the differentiation of any given mathematical expression. When User types the expression say Sin(Cos(x^2)) I need to check whether it is mathematically valid or not. Of course we can do it by manual code writing but that would be tedious work. Can I do it using regex package of java?? How?? ...

Escaping partial regex pattern

Hello, I search to built a pattern composed by some fixed parts and a variable (in reality Business Unit name). In fact, there is high chance that the variable contains some specific regex characters which can be recognize as regex control ones (i.e + or *). Is there any regex tag that notice that a pattern subpart should be considered...

Regexp: is it possible to search for string 'string' but not 'string({'

I am trying to find out all occurences of my concrete word (method call with deprecated API) in all files in a directory. I need a regexp to find all such occurences which do not contain updated call (new API). Can you help me please? Example: deprecated api: method(a,b,c) new api: method({a:a, b:b, c:c}) The regexp should find all ...

Looking for a RegEx Find and Replace Visual Studio addons

Hi I am looking for a Visual Studio Addon which does standard Regular Expression Find and Replace, not the Microsoft Visual Studio version of Regular Expression As you do not get the complete syntax Please help? Thanks ...

Javascript - how to find hebrew?

hi, i"m trying to fint if a string starts(first letter) width an RTL language/ hebrew. any ideas? ...

Query on Regular Expressions in Oracle

Hi, I'm trying my hand in learning Regular Expressions in Oracle ( rather, my first attempt in doing anything with RegEx). What does the character ^ signify at the start ? The documentation mentions Use the caret and dollar sign to define patterns that match the start or end of a string. ^ defines that start of a string or column 1 ...

Regex needed for parsing a date/time string

Can someone provide me with a regex for the following? (Using Javascript) source string: Jan 2 2010 6:00PM I want the resulting string to show only the time, as shown below. (example above used) result string: 6:00 PM ...

How can I support * in user-defined search strings in python?

This question is related to this stack overflow question: http://stackoverflow.com/questions/238600/how-can-i-support-wildcards-in-user-defined-search-strings-in-python But I need to only support the wildcards and not the ? or the [seq] functionality that you get with fnmatch. Since there is no way to remove that functionality from fn...

Strong password regular expression that matches any special char

I need the following check for strong password validation: At least 7 chars At least 1 uppercase char (A-Z) At least 1 number (0-9) At least one special char I found and tweaked a RegEx and it's like this (sorry, I lost the reference...): ^.*(?=.{7,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@'#.$;%^&+=!""()*,-/:<>?]).*$ It's working in...

C# complicated regex

Hey guys, thanks for all the help that you can provide. I need a little bit of regex help thats far beyond my knowledge. I have a listbox with a file name in it, example 3123~101, a delimited file that has 1 line of text in it. I need to Regex everything after the last "\" before the last "-" in the text file. The ending will could co...

Regex match even number of letters

Sorry if this is redundant. I need to match an expression in python with regular expressions that only matches even number of letter occurances. For example: # Even number of A's AAA # no match AA # match fsfaAAasdf #match sAfA # match sdAAewAsA # match AeAiA # no match EDIT: Sorry for confusion. You are right - even number of A's ...

Checking for numeric value in field + SQL Server

Hey Everyone, What would be the most efficient way to check for numbers in a field that would contain a few letters? I would like to do this if the where statement as possible. The data would look something like this: 3833N4323 32N907654 5W5840904 ...

regex to get weight

I have html that has the weight of a item. <div><b>Item Weight (0.51 lbs in Warehouse 3)</b></div> I need a regex to get the weight and unit of measure. So in the above html, I need: 0.51 and lbs I am using java, I have a helper method, just need to get the regex down now! String regexPattern = ""; String result = ""; Patte...

how to parse a file with keyword-value pairs and {} and line breaks in Java?

In a file I have some variables stored like this: author = {Some Author}, link = {some link}, text = { bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla}, ... Some of the variables are on multiline. After that i need to spit the every String entry into key and value, but thats not a probl...

Javascript Regular Expression replace() problem.

Hi, i'm trying to validate an input field and store it using AJAX My js code is : <script type='text/javascript'> function addICValidate() { var invalidString=/[^a-zA-Z\s]/; // Alphabets with spaces only var searchQuery=document.getElementById('addICName').value; var validQuery=searchQuery.replace(invalidString,"")...

Removing duplicates in a comma-separated list with a regex?

I'm trying to figure out how to filter out duplicates in a string with a regular expression, where the string is comma separated. I'd like to do this in javascript, but I'm getting caught up with how to use the back-references. For example: 1,1,1,2,2,3,3,3,3,4,4,4,5 Becomes: 1,2,3,4,5 Or: a,b,b,said,said, t, u, ugly, ugly Becom...

How to substitute place holders in a string with values

Given the string string command = "%ans[1]%*100/%ans[0]%" Will replace to %ans[1]% to array[1] %ans[0]% to array[2] How do I substitute the place holders in command with the values in the array to get the following result? Should I use Regular Expressions for this? And using Regex.Replace ? "test2*100/test1" ...

PHP: Return string between two characters

I am wanting to use "keywords" within a large string. These keywords start and end using *my_keyword* and are user defined. How, within a large string, can I search and find what is between the two * characters and return each instance? The reason it might change it, that parts of the keywords can be user defined, such as *page_date_Y...

Regex for matching alternating sequences

I'm working in Java and having trouble matching a repeated sequence. I'd like to match something like: a.b.c.d.e.f.g. and be able to extract the text between the delimiters (e.g. return abcdefg) where the delimiter can be multiple non-word characters and the text can be multiple word characters. Here is my regex so far: ([\\w]+([\\...