Hi i want pattern for checking no white space.

Here you go, (?! +) that should work.

Hi joshl_1995 can you send me any example.

Member Avatar for diafol
^\s

For the example, it depends what you want? preg_match, preg_replace... ?

ok thakns

hi diafol i used this pattern in my this programme.

$string = "Ashok Kumar";

if(preg_match($pattern,$string)){
    echo "Pattern matched";
}else {
    echo "Pattern not matched";
}

but i dint get any result. it give same output for
$string ="AshokKumar" and
$string ="Ashok Kumar"

Here this works

<?php
    if (preg_match("/\s/", "hello there")) {
        echo "Match";
    } else {
        echo "No match";
    }
?>
Member Avatar for diafol

but i dint get any result. it give same output for

As I said, it depends on how you want to use it. If you want to just see if there's whitespace - see joshl

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.