pattern "?" problem, need help please!
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

pattern "?" problem, need help please!

Started by blackwings, 29 July, 2005, 01:15:44

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

blackwings

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 :(


blackwings

#1
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".


VidFamne

Isnt it '%d?' to catch one digit or none digit?

blackwings

#3
QuoteOriginally posted by VidFamne
Isnt it '%d?' to catch one digit or none digit?
ya, ? = 0 or 1 repitions


blackwings

#4
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 ;)


blackwings

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


SMF spam blocked by CleanTalk