Questions tagged [regex]

a regular expression (abbreviated regex or regexp) is a sequence of characters that forms a search pattern, mainly for use in pattern matching with strings, or string matching, i.e. "find and replace"-like operations.

Filter by
Sorted by
Tagged with
2
votes
3answers
46 views

Remove duplicate values in an attribute using regex and fme

I have an FME process that is duplicating some values in an attribute. When I try to use regex in FME to clean it up it is deleting the separator (see screengrab below). Any ideas on how I can change ...
1
vote
1answer
50 views

Select the bands which not start with 'B' using regex in GEE [closed]

The image has the band : ['B1', 'B2', ..., 'B11', 'NDVI', 'NDWI']. The goal is to select the bands which not start with 'B' using regex. In another words, ['NDVI', NDWI']. What I know is that using ...
1
vote
1answer
108 views

QuickOSM using Wild Cards / RegEx

Can someone explain to me how to use wild cards with QuickOSM? I'm trying to match all shops with a name starting with a specific word (e.g. Costco).
1
vote
1answer
41 views

List datasets from geodatabase faster

I'm using a script to list datasets from multiple gdbs in ArcPy (to rename most datasets and gdbs). Which looks like this: dir_gdbs = 'D:\\mypath' os.chdir(dir_gdbs) lista_gdbs = glob.glob('*.gdb') ...
1
vote
2answers
177 views

Regex to get unique values in field using QGIS field calculator

I need to get the unique values from a field. (?<=,|^)([^,]*)(,\1)+(?=,|$) Works in an online test but I get invalid expression in QGIS Field Calculator. How can I rewrite this in QGIS Regex ...
2
votes
1answer
72 views

Keeping only 7 digit number within field name using ArcGIS Pro field calculator and regex

I have a field titled GEOGRAPHY, which contains hundreds of records containing various strings of all similar format, for example: "Witless Bay (1001559) T 00000 ( 6.5%)" "Laniel (2485905) NO ...
0
votes
1answer
176 views

Limit FME regex to just the first match

In FME I have the following in the AttributeManager transformer to replace a value in a column @ReplaceRegEx(@Value(Street_Address),"^([UNITunit]*.?\d+[\/-]?\d*\w).*",\1) This should work as in the ...
3
votes
1answer
196 views

PyQGIS search and replace text using regex

This is based on Run regexp in PyQGIS script? and Search and Replace text in All Fields in QGIS 3 I am trying to modify the code to allow more complex replacements using regex but am unsure how to ...
0
votes
1answer
57 views

Get code to run on every column in a table -Error “Could not find a public static method named …” -Mapbasic 17

I need to run a table update command on every column in a table. The code works fine when I manually define the column to work in but not when it is part of a for loop that gets all the column names I ...
2
votes
1answer
1k views

Can you auto-populate a field in Survey123 from another field by only pulling certain characters?

I have a field where the user inputs text Aa1Bb2Cc3 Am I able to auto populate another field by only populating the field with Bb or 3. Auto populate the field with characters [4:6] or just [9] ...
0
votes
2answers
94 views

Run mapbasic 32 bit mbx from larger mapbasic 64bit project

I need to run a 32-bit mbx within a 64-bit mbx -is this possible? Basically within a larger 64bit mbx routine, I need to call a mapbasic 32 bit mbx so that I can apply some regex code to a table. ...
0
votes
3answers
2k views

Element Tree and Regex [closed]

I want to findall tags that match root.findall("{http://trimble.com/schema/fxl}FeatureDefinitions/{http//trimble.com/schema/fxl}PointFeatureDefinition") or "{http://trimble.com/schema/fxl}...
1
vote
0answers
487 views

regexp_split_to_table to split my column on 2 different levels

Hi Guys is it possible to use regexp_split_to_table to split my column on 2 different levels. AS in split by ';' and then split by ' '. I have this "-29.617356578819454 30.394328366965055 0.0 0.0;-29....
2
votes
1answer
94 views

Changing certain attributes and creating a new field for combined data

I have this combined dataset with building heights divided up over several columns ''Height'' ''Building_h'' and ''Building_L. My end goal is to combine them all in one new column. There are however, ...
4
votes
1answer
404 views

Extract filename from path in field calculator

I try to extract the filename from a path in my attribute table in QGIS. regex_substr should be the way to go I assume, but testing all kinds of example from the web did not work out. I have images ...
3
votes
1answer
147 views

QGIS 2.18.12 REGEX Labelling Dilemma - Carriage Return

I'm having a drama labelling using RegEx in QGIS. Ideally, what I want is the lines labelled WITHOUT the 'Spec' in the middle. Which can be a variation of numbers and characters but I need to retain ...
1
vote
1answer
450 views

Can't create time-series raster WMS with Geoserver due to time regex expression issue

I am attempting to create a raster time-series WMS server using GeoServer and have been working off this tutorial provided here: http://docs.geoserver.org/stable/en/user/tutorials/...
2
votes
1answer
132 views

Removing Esri text formatting tags in QGIS?

I have got a shapefile that contains ESRI formatting tags in the column I want to use for labeling the layer in QGIS. The following is an example for a label of one feature (3 Labels in different ...
7
votes
2answers
2k views

Why do regular expressions that work on regex101.com not work in qgis?

I'm having trouble getting the qgis field calculator to validate regular expressions that work on regex101.com and also getting the same results between the two. I'm trying to extract the digits and ...
3
votes
1answer
243 views

Regex expression in mapinfo sql to remove special character

Is there a way to clean the values in the column to just have A-Z 0-9 and _ ? In python/regex I run def Alphanumeric(string): import re clean_string=re.sub(r'[^a-zA-Z0-9‌​_]', '', string) return ...
2
votes
1answer
5k views

How to select features where column matches a regex and save them in a new shapefile?

I want to select features from a shapefile where the value of column matches a regex then save only the selected features in a new shapefile.(I used regex101.com to write the regex and check if it's ...
1
vote
0answers
360 views

MapServer runtime execution: Cannot evaluate expression, no item index defined error

I'm trying MapServer's run-time substitution to dynamically set my Mapfile's CLASS EXPRESSION values. The expressions take the form of: CLASS EXPRESSION (([my_attr_col] >= num_1) && ([...
3
votes
1answer
239 views

PostGIS: floating point representation problem with ST_AsText

I have a table with geometries, all with about 13 digits of accuracy. While trying to represent them with ST_AsText though, most vertices come out in decimal notation, but some come out in scientific ...
1
vote
2answers
248 views

How to populate one column of a table by extracting the match of a Regular Expression?

I Have a CSV table where one of the columns has names of the post offices with the type given in brackets like this: Sri venkateswara puram (Sub Office) I want to extract the post office type, by ...
3
votes
2answers
443 views

Change case of Acronyms in PostGres

I have a table containing almost 1 million points (POIs). I want to change the case of all the acronyms in the display name column I have, currently I am identifying the acronyms as any 3 letter words ...
3
votes
1answer
470 views

How to use regular expressions within QGIS Actions

I have stored html links in a column of a postgis layer. There are a few entries which have multiple links stored in one cell (blank separated). I have to use the firefox.exe to open the links in ...
2
votes
1answer
2k views

Regular expression to match all numbers in comma-separated list in FME

In FME, I have a Feature Type with municipalities and their IDs, and a string attribute made of an unknown number of these IDs, separated by commas, like for example: 5586,5587,3468,9942 The goal is ...
1
vote
1answer
362 views

Using regex to find an attribute with no letters in FME Workbench

I need to divide address elements to lines. I am using 'TestFilter' transformator in FME Workbench to separate attributes with no letters. For this purpose I am using IF statement and regular ...
7
votes
4answers
8k views

Extracting text before forward slash (/) in QGIS?

I have a database of motorway junctions which are named like this: M90 J8/A91/B996 M90 J1/A90/A921/A985(T) M9 J1A There is significant variability in the length of the strings but they all follow ...
3
votes
1answer
1k views

Extracting text within parenthesis in a QGIS attribute table

I have a shapefile of data for Japan, and I need to extract the English character names in my "name" field in order to label the layer. Much of the data is all in Japanese, but some of the names have ...
0
votes
1answer
178 views

Installing mapserver in cygwin with regex.c

This is my first time installing mapserver in cygwin, but I am an experienced user of both cygwin and mapserver. The thing is that I'm getting a regex issue after doing cmake in the build directory ...
2
votes
1answer
816 views

How can I use regex in the AttributeCreator Advanced Editor in FME 2014?

I want to use regex to simply distinquish between POLYGON and MULTIPOLYGON using the regex term "\bPOLYGON" Apparently I can use the Advanced Editor and use @FindRegEx(<STRING>,<STRING>)...
3
votes
1answer
422 views

Best way to enforce valid table names when writing to a File Geodatabase

I have an FME Workbench which reads MapInfo files and writes them to a File Geodatabase. Generally, the workbench works pretty well, however, I've just come across an error which I though would have ...
4
votes
1answer
209 views

New attribute creation using ogr and regex

I've got a folder full of dxf files with elevation values included as part of a long text attribute. I've written a regex expression to extract the elevation value, and would like to add it as a new ...
1
vote
1answer
2k views

QGIS Regex substring for Labelling

I'm trying to plot a series of contours in QGIS based on dxf data exported from some specialised mining software. The attirbute output is pretty ugly and merges a few fields together. DXFName=C$5 ...
1
vote
2answers
612 views

Writing QGIS regex for rounding to two places after decimal point?

In QGIS field-calculator round() is not working in QGIS 1.8 so I try to do the following with a regex: I'd like to keep the first two places after the decimal point - where do I go wrong? ...
9
votes
6answers
10k views

Creating label formatted like “ 1,000' ” from numeric field?

This question builds on a previous question I came across at gis.stackexchange: How to easily edit attribute data using Regular Expressions? Perhaps someone can point me in the right direction? I ...
3
votes
1answer
1k views

VBscript Regular Expression in ArcMap Field Calculator

I'm looking for a regex in VBscript that I can use on a ArcMap table. I know what it would look like in python: pat =r'[0-9]{3,4}' This filters all numeric characters from the string which have the ...
2
votes
2answers
1k views

Implementing field validation rules in ArcGIS?

I've found that ArcGIS offers validation of 2 basic constraints: field data type and if the value is required or not. Is there any way or AddIn to attach more complex validation rules? I mean ...
2
votes
1answer
443 views

OpenLayers.Format.CQL Regex Problem

I have a cql filter as SQL. Im trying to parse this cql to OpenLayers.Filter using OpenLayers.Format.CQL.read() method. It all works fine since my input is ascii. When I type Turkish characters as ...
7
votes
2answers
2k views

selecting by attribute and specific value replace

I want to select all of the features by attribute where the attribue in myattrib is like... Selection "criteria H". That is not a problem. However then I need to replace (myattrib," H", "") except ...