I have field called name which has values like Ahmed and Marten. I need to check if this is the title without considering and.

The answer is no for if(name is title(name) ,'yes','no') because of and. So I need to get yes in the QGIS query.

  • Welcome to GIS Se. Sorry, your question is unclear. You want to delete and from Ahmed and Marten? You can do this using the replace() function.
    – Babel
    Mar 19 at 21:53
  • 1
    Welcome to GIS SE. Please take a tour to learn how the site works. Mar 19 at 22:09

2 Answers 2


You need to replace ' and' with ''. E.g. Ahmed and Marten -> Ahmed Marten, and then check replaced_name is title(replaced_name).

Use this expression:

    'text',  -- variable name
    replace("name", 'and ', ''), -- replace 'and ' with ''
    if ( @text is title(@text),  'yes', 'no' )

Ahmed and Marten -> yes
Ahmed and marten -> no
ahmed and Marten -> no
ahmed and marten -> no


I don't know if I understand your question correctly. But try something like:

if( strpos( 'the name you are searching for' , "name" ) > 0 , 'yes' , 'no' )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.