Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    [Regex]Compilation failed: range out of order

    Ciao.
    Mi piacerebbe conoscere il motivo perchè
    questa
    function isValidString($str){
    return (bool)preg_match('#^[A-Za-z0-9_-\?]{5,15}$#D',$str);
    }

    mi restituisce il messaggio in oggetto


    mentre questa funziona

    function isValidString($str){
    return (bool)preg_match('#^[\w-_\?\.\*]{5,15}$#D',$str);
    }


    Without faith, nothing is possible. With it, nothing is impossible
    http://ilwebdifabio.it

  2. #2
    Probabilmente perche' nella prima non hai applicatio l'escape al carattere - dopo l'underscore (_). Prova:

    Codice PHP:
    function isValidString($str){
       return (bool)
    preg_match('#^[A-Za-z0-9_\\-\\?]{5,15}$#D',$str);


  3. #3
    Originariamente inviato da filippo.toso
    Probabilmente perche' nella prima non hai applicatio l'escape al carattere - dopo l'underscore (_). Prova:

    Codice PHP:
    function isValidString($str){
       return (bool)
    preg_match('#^[A-Za-z0-9_\\-\\?]{5,15}$#D',$str);

    Già già e anche perchè messa come l'avevo messa
    indica un range '_' a '?' e '-' ha un valore ASCII +
    alto di '?'

    Without faith, nothing is possible. With it, nothing is impossible
    http://ilwebdifabio.it

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.