[Qgis-user] Field calculator  regexp_substr.
    Fernando M. Roxo da Motta 
    petro at roxo.org
       
    Thu Nov  5 14:14:22 PST 2015
    
    
  
  Hi all,
  I have a shapefile with a string field (Label) with a content like
"Line '15'", a text string (without the double quotes).  I want to
create a new numeric field containing the value in the string field.
  I was able to create it using the function:
  to_int( regexp_replace( "Label", '.*([0-9]{1,}).*', '\\1''))
  I noticed that there is a function "regexp_substr", if I understood
correctly, I should be able to use this just specifying the regex of
the desired substring.  I hoped to be able to use:
   to_int( regexp_substr( "Label", '[0-9]{1,}'))
The return are just empty strings.    Am I missing something?
  BTW, I am using Qgis 2.12.0-Lyon on Xubuntu 14.04 64 bits.
  Best regards.
  Roxo
-- 
---------------- Non luctari, ludare -------------------+ WYSIWYG
Fernando M. Roxo da Motta <petro at roxo.org>              | Editor?
Except where explicitly stated I speak on my own behalf.|  VI !!
      ( Usuário Linux registrado #39505 )               | I see text,
------------ Quis custodiet ipsos custodes?-------------+ I get text!
 
    
    
More information about the Qgis-user
mailing list