Jump to content
php.lv forumi

Preg vai like vai ka...


goma smile

Recommended Posts

waplet, r u srs?

 

http://stackoverflow.com/a/6403154/540394

 

WHERE text REGEXP '[[:<:]]port[[:>:]]' -- \bport\b

WHERE text REGEXP '[[:<:]]airport[[:>:]]' -- \bairport\b

 

Case-insensitive ir defaultā: REGEXP is not case sensitive, except when used with binary strings.

Edited by jurchiks
Link to comment
Share on other sites

Paldies Juri !

 

sastapos ar vēlvienu variantu :D

 

Astrakhan (Narimanovo Airport) (ASF) - Lidosta
Tallinn Port - Osta

 

un atradu 3 variantu : "Orlando international airport hotels"

 

nezinu ko ar viņu darīt varētu sākumā izvilkt visas lidostas/ostas/  jaunā kollonā, un pēctam ar LIKE '%hotels%' lai izsijātu viņus kā hottels. un pēctam visu pārējo kas kur nebūs vārds keywordi / airport/port/hotel(s)/ uztaisīt uz "place" un problēma varētu būt atrisināta...

 

Vēlreiz paldies :)

Link to comment
Share on other sites

alter table xyz add column `type` varchar(16) not null default 'other';

 

update xyz set `type` = 'port' WHERE text REGEXP '[[:<:]]port[[:>:]]' AND type = 'other';

update xyz set `type` = 'airport' WHERE text REGEXP '[[:<:]]airport[[:>:]]'AND type = 'other';

update xyz set `type` = 'hotel' WHERE text LIKE '%hotel%'AND type = 'other';

 

nu un tad paskaties, kam paliek type='other', un izdomā, varbūt tur vēl kādu tipu var uzlikt.

Edited by jurchiks
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...