Project

General

Profile

Actions

Bug #5707

open

While loop breaks when using $regex()

Added by westor (GR) about 1 year ago. Updated about 1 year ago.

Status:
New
Priority:
Normal
Assignee:
Category:
Scripting
Target version:
Start date:
04/10/2023
Due date:
% Done:

0%

Estimated time:
Operative System:
All
Regression:
No

Description

Hello,

I was trying to use that code, it seems the loop stops and breaks after 2nd iteration.

Try to use: /test_nicks test1 test2

alias test_nicks {
  ; /test_nicks de]bian de^bian de-bian de`bian dgdgd-de[b]ian_hdhdfh de[b]ian de}bian|legen de}bian d{e}bian

  if (!$1) { echo -a Error: Enter nicks! | return }

  var -s %nicks = $1-
  var %total = $numtok(%nicks,32)
  var %index = 1
  while (%index <= %total) {
    var -s %nick = $gettok(%nicks,%index,32)

    if (!$chkbadnick2(debian,%nick)) { echo -at Nick NOT matching! -> %nick | return }

    inc %index
  }

  echo -at Ok all nick(s) matching.
}

alias chkbadnick2 { 
  var %s = [-a-z_`|{}^\[\]\d]*

  if ($regex($2,/^(?! $+ \Q $+ $replacecs($1,\E,\E\\E\Q) $+ \E $+) $+ %s $+ \Q $+ $replacecs($basenicktoregex($1,%s),\E,\E\\E\Q) $+ \E $+ %s $+ $/i)) { return 1 }
}

alias basenicktoregex { 
  var %name $2

  return $regsubex($replace($1,o,[0o],e,[e3],etc,[etc]),/(\[[^\]]+\]|.)/g,\1+ $+ %name) 
}


- Thanks!
Actions

Also available in: Atom PDF