Tags down


Replace regex-matched word with modified version of the word

By : Leobel Izquierdo Alv
Date : October 18 2020, 08:10 PM
I wish did fix the issue. Use parentheses to create a "matching capture group". To refer to the first group, use \1, and so on:
code :

Share : facebook icon twitter icon

Use RegEx with IgnoreCase to replace a word but replace using correct found word case

By : Ajit Cs
Date : March 29 2020, 07:55 AM
To fix this issue So I'm replacing all instances of a word in a string ignoring the case:
code :
public static string ReplaceAll(string source, string word)
    string pattern = @"\b" + Regex.Escape(word) + @"\b";
    var rx = new Regex(pattern, RegexOptions.IgnoreCase);
    return rx.Replace(source, "<span class='highlight'>$0</span>");

Regex match word groups and parts of previously matched word groups

By : sndp.jn
Date : March 29 2020, 07:55 AM
this will help The issue is that you want to catch overlapping patterns (like "having with" and "with the"). You can do this with a cunning bit of look-ahead. I haven't managed to combine into a single regex with this method yet, but you could do something like this:
code :
$text = 'This is an example text to explain the problem I am having with the regular expression';

preg_match_all('/\b(\w{4,})\b/', $text, $matches1);
preg_match_all('/\b(?=(\w{4,}\s+\w{3,}))\b/', $text, $matches2);
preg_match_all('/\b(?=(\w{4,}\s+\w{3,}\s+\w{3,}))\b/', $text, $matches3);

var_dump(array_merge($matches1[1], $matches2[1], $matches3[1]));

Ruby regex extract words between {{word|word|word} {word|word|word}}

By : user7801152
Date : March 29 2020, 07:55 AM
should help you out How can I get the individual words contained only within {} out of the text , Try:
code :

how to replace matched regex word to uppercased first char

By : Kenneth Asobo
Date : March 29 2020, 07:55 AM
this will help i want to replace matched word by another word, but need change one index to uppercase first character. , you can use \u in regex like this:
code :
statement: if\(\$requestData\[['|"]action['|"]\] == ['|"]([a-zA-Z]+)['|"]\)  
replacement regex: public function action\u$1()

MySQL - REGEX Search word from string and matched word should be either alnum or numeric only

By : Nnov Leumik
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further I want to recommend wordboundary syntax like this: REGEXP '[[:<:]]demo[[:>:]]'
code :
SELECT * FROM address WHERE address REGEXP '[[:<:]]demo[[:>:]]' AND 'demo' REGEXP '[0-9]'
Privacy Policy - Terms - Contact Us © voile276.org