Could any wiz at regular expression write an expression that will check whether a string matches this format

number=string

must have the =sign included, the number can be anything up 3 numbers and the string can contain any characters

this would very much apreciated

i've been tryin this d*3/=/{aA-zZ}$/

thanks

1-3 numbers, at least one character:

\d{1,3}=[a-zA-Z]+

If you'd want letters, digits and underscores, you can use:

\d{1,3}=\w+

if (preg_match("\d{1,3}=\w+", "123=hel_llo")) {
echo "A match was found.";
} else {
echo "A match was not found.";
}

i've written this code, and it brings up an error message? see below

'Delimiter must not be alphanumeric or backslash'

and how can i get it to work

You did not specify a delimiter:

preg_match("%\d{1,3}=\w+%", "123=hel_llo"))
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.