PtokaX forum

Development Section => Your Developing Problems => Topic started by: blackwings on 29 July, 2005, 01:15:44

Title: pattern "?" problem, need help please!
Post by: blackwings 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 :(
Title:
Post by: blackwings on 29 July, 2005, 02:08:41
QuoteOriginally posted by Mutor
%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".
Title:
Post by: VidFamne on 29 July, 2005, 02:44:11
Isnt it '%d?' to catch one digit or none digit?
Title:
Post by: blackwings on 29 July, 2005, 02:52:13
QuoteOriginally posted by VidFamne
Isnt it '%d?' to catch one digit or none digit?
ya, ? = 0 or 1 repitions
Title:
Post by: blackwings on 29 July, 2005, 04:26:48
QuoteOriginally posted by Mutor
Quotewhat 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

QuoteOriginally posted by Mutor
Quoteand 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 ;)
Title:
Post by: blackwings on 29 July, 2005, 06:31:46
QuoteOriginally posted by Mutor
QuoteBut it cant just find "c".

Quoteehm, 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?)".