Author Topic: pattern "?" problem, need help please!  (Read 2149 times)

0 Members and 1 Guest are viewing this topic.

Offline blackwings

  • Scripter
  • King
  • ******
  • Posts: 986
  • Karma: +12/-8
pattern "?" problem, need help please!
« on: 29 July, 2005, 01:15:44 »
I have a problem when using the magic char "?".

when I do this = "c(1?)", it can find c or c1.

but if I do this = "c(%b?)", then it wont work :(


PtokaX forum

pattern "?" problem, need help please!
« on: 29 July, 2005, 01:15:44 »

Offline blackwings

  • Scripter
  • King
  • ******
  • Posts: 986
  • Karma: +12/-8
(No subject)
« Reply #1 on: 29 July, 2005, 02:08:41 »
Quote
Originally posted by American Idiot
%b<>  matches anything between the < >,  they can be replaced by anything you want
that wasn't what I meant :baby:

what I meant is that it seems like when you use pattern objects like %a and %b etc, "?" won't work :(

and what I mean by not working is that with "c(%b?)", it can find c1, c2, c3 etc. But it cant just find "c".
« Last Edit: 29 July, 2005, 02:12:35 by blackwings »


Offline VidFamne

  • Triple Ace
  • **
  • Posts: 173
  • Karma: +2/-0
(No subject)
« Reply #2 on: 29 July, 2005, 02:44:11 »
Isnt it '%d?' to catch one digit or none digit?

Offline blackwings

  • Scripter
  • King
  • ******
  • Posts: 986
  • Karma: +12/-8
(No subject)
« Reply #3 on: 29 July, 2005, 02:52:13 »
Quote
Originally posted by VidFamne
Isnt it '%d?' to catch one digit or none digit?
ya, ? = 0 or 1 repitions
« Last Edit: 29 July, 2005, 02:52:25 by blackwings »


Offline blackwings

  • Scripter
  • King
  • ******
  • Posts: 986
  • Karma: +12/-8
(No subject)
« Reply #4 on: 29 July, 2005, 04:26:48 »
Quote
Originally posted by American Idiot
Quote
what I meant is that it seems like when you use pattern objects like %a and %b etc, "?" won't wor
Well, it wont work with %b, because by itself its not a valid pattern. We normally use %b in Ptokax for username in pattern, which is in <> so, we do %b<>.
You need to supply the next two charachters for %b, could be %b[], or %b{}, or %baz.
ok,whoops, I typed the wrong letter when I posted in the forum, I meant %d.

Anyway, it isn't just %d it doesn't work with, its all of them =
%a,%c,%d,%l,%p,%s,%u,%w,%x,%z

Quote
Originally posted by American Idiot
Quote
and what I mean by not working is that with "c(%b?)", it can find c1, c2, c3 etc. But it cant just find "c".

Why should 'c' match the pattern? You'll only match what's in parenthesis, if 'c' precedes it.
ehm, no, actually not ;) if you use c(1?), it can find c and c1 ;) and if you just have c(%d), it can find for example c1 c2 c3 c4 etc ;)
« Last Edit: 29 July, 2005, 04:27:18 by blackwings »


Offline blackwings

  • Scripter
  • King
  • ******
  • Posts: 986
  • Karma: +12/-8
(No subject)
« Reply #5 on: 29 July, 2005, 06:31:46 »
Quote
Originally posted by American Idiot
Quote
But it cant just find "c".


Quote
ehm, no, actually not  if you use c(1?), it can find c and c1  and if you just have c(%d), it can find for example c1 c2 c3 c4 etc
'c' may start the pattern, yet its not part of the capture [if capturing]. You should only use '?' there if '1' [or %d ] is not a required capture.
it can find just "c" if its "c(1?)", but not if its "c(%d?)".


PtokaX forum

(No subject)
« Reply #5 on: 29 July, 2005, 06:31:46 »