I'm trying to write a simple PHP function that can take a string like
Topic: Some stuff, Maybe some more, it's my stuff?
and return
topic-some-stuff-maybe-some-more-its-my-stuff
As such:
lowercase
remove all non-alphanumeric non-space characters
replace all spaces (or groups of spaces) with hyphens
Can I do this with a single reg...
Hi All,
I have below test cases as input:
[This is my test] [This is my test] My name is xyz.
Want Expected output as :
[This is my test] My name is xyz.
.
[This is my test] My name is xyz.
Want Expected output as:
My name is xyz.
For above test cases I want to replace only first occurrence of '[This is my test] ' with blank. I...
Chinese/Japan/Korean char is double-byte or Unicode.
...
Why does the following code result in:
there was 1 matches for 'the'
and not:
there was 3 matches for 'the'
using System;
using System.Text.RegularExpressions;
namespace TestRegex82723223
{
class Program
{
static void Main(string[] args)
{
string text = "C# is the best language there is in...
I'm adding an if statement to my database abstraction layer to pick out any attempted queries to a handful of database tables.
Basically, if my application attempts to create, read or destroy data from a database table called either members or members_profiles I want to invoke my if statement.
if (
preg_match('/INSERT INTO [members...
Currently this regex returns one match:
the best language in the
world and the fastest language
How can I get it to return two matches:
the best language
the fastest language
string text = "C# is the best language in the world and the fastest language in the world";
string search = @"\bthe\b.*\blanguage\b";
MatchCollec...
Playing around with regular expressions, especially the balanced matching of the .NET flavor, I came to a point where I realized that I do not understand the inner workings of the engine as good as I thought I did. I'd appriciate any input on why my patterns behave the way they do! But fist...
Disclaimer: This question is purely theoret...
Using Mercurial, I need to ignore all files and directories except directories "tests" and "languages" and files in those directories. That all must be done with regex and .hgignoere
Files:
tests\junk.txt
cms\tests\some_file.txt
cms\languages\users\lang.txt
languages\lang2.txt
tests.txt
proba/tests.txt
I tried with this:
^(?!tes...
Hi,
I'm having 800 entries that are very similar, but they need some stuff done to them.
The format is like this:
<td class="description">
Describing text.
Might very well be 2 paragraphs
</td>
I need to do some stuff to the text inside the cell.
I've tried to use preg_replace('/(.+)<\/td>/'). It ends up with two problems.
...
Hi,
I am grabbing a block of text, within this block there will be a line containing a phrase that ends "WITH PASSWORD kEqHqPUd" where kEqHqPUd is a dynamically generated password. Can anyone provide a simple regex for grabbing just the password within this. FWIW i'm using PHP.
Thanks
...
I am trying to allow an empty string or null string in my regular expression:
^[0-9][0-9]*
what should I add to achieve this, thanks
...
So I've been playing around with the replace function (method?) in js.
$get('msgBar').replace(/+/g,' ');
Let's say the content of $get('msgBar') is "Welcome+back+now".
replace('+',' ') would only replace the first +, and not the second.
replace(/+/g,' ') crashes
replace(/"+"/g,' ') and replace(/\+/g,' ') are both the same as the fi...
Please consider the following very rudimentary "controllers" (functions in this case, for simplicity):
function Index() {
var_dump(__FUNCTION__); // show the "Index" page
}
function Send($n) {
var_dump(__FUNCTION__, func_get_args()); // placeholder controller
}
function Receive($n) {
var_dump(__FUNCTION__, func_get_args())...
Can someone help me create this regex. I need it to check to see if the string is either entirely whitespace(empty) or if it only contains positive whole numbers. If anything else it fails. This is what I have so far.
/^\s*|[0-9][0-9]*/
...
Hello,
I am new to JFlex. I have gathered that JFlex is a parser generator.
However, I am still not clear about the following and need clarification around the same.
How different this is from using regex for pattern identification and data segregation and what are the additional benefits of using JFlex.
Any specific use case where JF...
PLEASE NOTE: This is a CODE QUESTION NOT AN SYSTEM MANIPULATION ONE.
I have folders that have SEVERAL drilldowns (basically a folder inside a folder inside a folder...). I was wondering how if anybody knew how to rename folder names using RegEx? Basically i need to get rid of ~ ” # % & * : < > ? / \ { | } in any folder names. I was ...
I'm in a situation where I need to parse arguments from a string in the same way that they would be parsed if provided on the command-line to a Java/Clojure application.
For example, I need to turn "foo \"bar baz\" 'fooy barish' foo" into ("foo" "bar baz" "fooy barish" "foo").
I'm curious if there is a way to use the parser that Java o...
Is it possible using Regex.Replace to match a string, but only replace a portion of that matched string? Some way to mark part of the string that should be replaced with the replacement text parameter?
...
hi,
we need help how to write the regex for string.split so we can split a string in half.
thanks.
...
Hi There
I am hoping that someone can help me to make this match non greedy... I am using Javascript and ASP Classic
.match(/(<a\s+.*?><\/a>)/ig);
The purpose is to extract URL's from a page in this format <a href ></a>
I need to capture just the url
Thanks
...