Quantcast
Channel: Active questions tagged regex - Stack Overflow
Browsing index pages (9593 articles)
↧

Having trouble with regular expressions [closed]

I have two questions:1)function LongestWord(sen) { var word = /[^\W\d]([a-z]+)[$\W\d]/gi; var answer = word.exec(sen); return answer;}console.log(LongestWord("9hi3"));Why does this return [hi3, i] as...

View Article


How to write a PDO parameterized query with multiple REGEXP conditions

I am having a problem with using REGEXP in my SQL query using PDO method. When I execute the statement I get nothing from the DB. I want to be protected from SQL Injections and I am just learning it.If...

View Article


Get Silver or Gold Rate

I'm written widget program to get price of silver or gold price from Bloomberg websitethese are parts of the script :function getPrice() { var url = new URL(); url.location =...

View Article

How do I return only the matching regular expression when I...

I am trying to find a pattern in files. When I get a match using Select-String I do not want the entire line, I just want the part that matched. Is there a parameter I can use to do this?For example:If...

View Article

PHP: regular expression to remove `â` or `â€`?

I use this regular expression to remove all the punctuation marks from a string input,$pg_url = preg_replace("/\W+/", "", $pg_url); but there are some kind of symbols or special characters I can't...

View Article


Why does a hyphen inside a regex character class not match a hyphen in the...

I am missing something very trivial in this regular expression. would you help me figure it out.Valid Input: Tonny & 'One' 1234-5 tea be and ZRegex: /^([a-zA-Z',\s,\d,&,#,-,(,)])*$/;As per my...

View Article

How to write a search pattern to include a space in findstr?

I want to search all files in a certain directory for occurrences of statements such as Load frmXYZI am on Windows 7, using the findstr command. I tried: findstr /n Load.*frm *.*But this gives me...

View Article

Convert DSN string in Python to kwargs

I have a simple string which describes a MySQL connection. The string is in this form:dsn = 'user=dbuser database=mydbase host=localhost'This string can contain many of the things listed in the...

View Article


What kind of regular expression captures the root of a URL? [duplicate]

Consider the following examples of...

View Article


Image may be NSFW.
Clik here to view.

Extract Multiple Variants and Patterns of Middle Initials within First and...

I would like preferably a Microsoft Excel REGEXEXTRACT formula or Office 365 formula (No VBA Macros) to successfully extract all variants of Middle Initials containing multiple patterns with All...

View Article

Regex to replace 'NO-BREAK SPACE'

I am looking for a regex to replace 'NO-BREAK SPACE's from a string.There are some question on SO related to 'NO-BREAK SPACE', but none seems to point me to the right answer.So far, i tried to use...

View Article

ASP.NET MVC regex route constraint

I'm having trouble with a specific constraint I'm trying to set up on a route. My URL must look like this one: http://hostname/id-my-title-can-be-that-long where id is composed with digit only and the...

View Article

Graylog Search with strings containing /

I have logs which contains in full_message;-EndPoint:example/example/abc-EndPoint:example/example/qfdsf-EndPoint:example/example.. and so onI am trying to write a search query to just get...

View Article


What do 'lazy' and 'greedy' mean in the context of regular expressions?

What are these two terms in an understandable way?

View Article

What is the position of an unmatched group in C++?

Let m be of type std::smatch . Suppose there is an unmatched group i. What ism.position(i) ? For that matter, what is m[i]?For example, considerstd::regex re {"^(a+)|(b+)"};string...

View Article


Regex to identify all "special" characters

I have a table, sales, with a column, email_address. I want to filter out the records in the sales table that have any characters that are neither alphanumeric nor special characters. These include A-Z...

View Article

Adding ?nocache=1 to every url (including the assets like stylesheet) behind...

Alright, this is due to the pain that godaddy gives me by implementing their own caching in a MANAGED WORDPRESS hosting. I looked it up and as it turns out, their flush caching facility is not...

View Article


What is the purpose of .? in the regex (.?.+?)(?:\/([0-9]+))?\/?$

The following regex expression is used in rewrite rules to match page and post names in URLs in a WordPress install with 'Post name' set as the permalink structure:(.?.+?)(?:\/([0-9]+))?\/?$What is the...

View Article

Image may be NSFW.
Clik here to view.

Regex to validate a whole URL (in PHP) incorrectly matches part of the URL

I was developing a simple regex to parse part of a URL, the regex must be able to capture part of the url in a named group, there are only a few allowed characters (a-z0-9 and -) if other characters...

View Article

Regex to match start and middle of a string to parse Content-Type header

I'm trying to break a string into groups where the start and optional middle are matched, and also the part before and after the optional middle is captured in a group.This is my work-in-progress RegEx...

View Article
Browsing index pages (9593 articles)


Latest Images