google analytics – RegEx Filter for merging different URLs (PhpBB)

I have a phpBB forum and would like to summarize the various URLs Google Analytics triggers into 1. Example:


I want them to show everyone


I have developed the following regEx filter:

Search and replace
-> Filter Field: Request URI

Search term: /forum/viewtopic.php?f=((0-9)*)&t=(0-9)

Replace string: /forum/viewtopic.php?t=((0-9)+)$

It does not work, I'm not sure what I miss here. Any help?

regex – Optional group is not recorded

I have a huge log file that I want to turn into a spreadsheet. The file looks like this:

Um monte de coisas  
Que não preciso
Mais coisas que não preciso
Um monte de coisas 
Que não preciso
Um monte de coisas
Mais coisas que não preciso

I can capture the first two groups, but not the optional third, using the following regex pattern:


I need something like this:


However, use the override pattern 1;2;4n In Notepad ++ I get only the following:


Why can not I capture the optional group? Apparently, the pattern matches the entire record without "penetrating" the next one.

Swift: extract string with regex and range

In Swift I have such a string 2BauSvy& Expires = 1568682491 & OSSAccessKeyId = LTAIQ8Lif1HHVkXd

Need to extract 2BI%2BauSvy, the value of the key Signature

Here is code: Regex match. Then use range to subtract the key from you.

let key = "Signature"
let signatures = icon.matches(for: "(key)(^&)+")
guard !signatures.isEmpty else{
if let range = signatures(0).range(of: "(key)="){
      let signature = String(signatures(0)(range.upperBound...))

How can you implement it conveniently?

regex – The regular expression of GNU Octave may incorrectly number optional groups

Referral groups (parentheses) in a regular expression are executed with $1 $2 $3etc. in GNU Octave and matlab,

But in both GNU Octave and matlab Optional groups are not numbered if they do not match. Is this a bug?

Here is an example:

ans = c,b,a
ans = ,c,a

expected result of the second variant:


here is something similar in sed:

echo -e "abcnac" | sed -E 's/(a)(b)?(c)/3,2,1/'

If I look at the regular expression, there are three sets of parentheses, and the third is definitely the one that should match c so that c should come first in the output. However, since the second does not match, c is updated in the backreferences on slot 2.

I think that this is a mistake because the author of the regular expression may not know if a string will contain the optional bit or not. Regardless, the author must decide in advance what to replace by what reference.

It seems to me that sed If you do it correctly, the numbering should match the parentheses in the regular expression, not the way the groups match.

A workaround I'm using now is to be used * Quantifier and ? within the group, instead of making groups optional.

In order to:

ans = c,,a

However, this is more complicated with more complex regular expressions, e.g. For example, when searching for a variable with possibly an index:


should fit lambda and lambda(1)but also catches lamda() versus


That's what I really want, but that'll mess up the referencing.

I tested it very fast in Matlab and it seemed to be the same.

regex – Install Package – Stack Overflow

Thank you for your contribution to Stack Overflow in Portuguese!

  • Be sure answer the question, Find out in detail about your solution and share your results.

But avoid

  • Ask for clarification or details about other answers.
  • Make statements based solely on your opinion. point to earlier references or experiences.

For more information, see our tips for writing good answers.

Split chain with regex, whereby the limiter is preserved

I have a string that comes to me in JSON with some data like this

{"name": "AMD", "history": {"2019-09-05": {"open": "31.79", "close": "31.50", "high": "32.05", "low" : "31.12", "volume": "57693493"}, "2019-09-04": {"open": "31.32", "close": "30.95", "high": "31.83", "low" : "30.85", "Volume": "46709780"}, "2019-09-03": {"Open": "30.83", "Close": "30.90", "High": " 31.14 "," Low ":" 30.68 "," Volume ":" 38080254 "}, … etc


 string() cotizacion = Regex.Split(cadena_url, @"d{4}-d{2}-d{2}");

I have created an item in the quotation marks array for each day. The problem is that the split eliminates the date and I'm interested in keeping the date and adding it to the array.

I can not add the date to the array.

Many thanks for the help.

Javascript – Regex help for formatting numbers with commas

I have a bunch of numbers that look like 999999999.99999, and I want it to be 999.999.999.99999

The following code works, but I get commas after the comma as follows: 999.999.999.99.999

var numberstring = 999999999.99999;
numberstring.toString().replace(/B(?=(d{3})+(?!d)(W))/g, ",");

Any help is greatly appreciated! Many thanks.

postgresql – Regex character class: print: in postgres

I'm trying to replicate an Oracle test condition that prevents characters from being printed in Postgres, and I'm at a loss. I think Postgres can handle: print: and: ascii: as synonymys?!?

select REGEXP_REPLACE('bla', '(^(:print:))', '(X)','g') ;
(1 row)

select REGEXP_REPLACE('bla'||chr(10)||'bla', '(^(:print:))', '(X)','g') ;
(1 row)

select REGEXP_REPLACE('Ҕ', '(^(:print:))', '(X)','g') ;
(1 row)

select REGEXP_REPLACE('ñino', '(^(:print:))', '(X)','g') ;
(1 row)

Why should Ҕ and ñ be trapped in it?

Every guide is appreciated.

PHP – What's faster for parsing? Regex or built-in DOM?

I want to extract HTML tags and their content from a string. So far I have two options:

  1. Using the integrated regex (preg_match)
  2. Using the built-in DOM object (new DomDocument())

Both work well. But I do not know what's faster, I do not know how to test.

$el = 'li'; // Ex
$match = (); // Reserving for results

 * Regex - extract HTML tag and its content
 * Array map:
 * x(0) = everything
 * x(1) = open tag
 * x(2) = attributes
 * x(3) = content & end tag
 * x(4) = content only
 * Note for content: including text node + children node
$reg = '/(<'.$el.'(.*?)>)((n*?.*?n*?)|)/';

if (preg_match($reg, $html_str, $match)) { echo 'Moving onward!';} # pure string

It works beautifully! Take a look at my demo of Regex.

$dom = new DomDocument();
$content = mb_convert_encoding(
    get_the_content(null, true), # WordPress func, it gives input str

$el = $doc->getElementsByTagName('li'); # DOMNodeList

It works out! But using a large object like DOM seems like wasted, right?

I would like some advice, which is better? Or at least teach me how to test them.