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
0 votes
2 answers
141 views

Identify and split data in other languages using QGIS

I have a dataset containing names in both English and other languages and mixed too. Is their any way to remove data containing other than English language? Eg:
  • 613
2 votes
2 answers
78 views

Identify and move data containing special characters to a separate column

My dataset contains special characters. I want to identify the data which contains special characters and separate it into a new column. List of special characters : `~!@#$%^&*_{}[]<>?/ ...
  • 613
5 votes
1 answer
142 views

Filtering list of data mixed with both full capital letter words and small letter words in QGIS

My dataset contains mixed values of both capital and small letter wordings, e.g. Hello world (contains fully small letter wording 'world') HELLO World (contains fully capital letter wording 'HELLO') ...
  • 613
3 votes
2 answers
130 views

Removing data existing in a closed brackets

I have a dataset that contains a number of closed brackets with data. I don't want the data which exists in the brackets. How can I remove that in QGIS? Mcdonalds(Park Avenue) KFC (Park Avenue) ...
  • 613
2 votes
4 answers
214 views

Matching backslash with regex in QGIS Field Calculator

I'm attempting to remove a part of string in an attribute column of a shapefile. The part in question is Snapshots\\ from Snapshots\390_measure_1.jpeg. So I want the output to be 390_measure_1.jpeg. ...
  • 382
0 votes
0 answers
31 views

Repetitions on regexp_replace [duplicate]

I'm using regexp_replace to replace expressions like 'Xm1 and Xm2'but also 'Xm11 and Xm2' or 'Xm22 and Xm11' with a text i have on a spreadsheet; Basically i want to make a VLOOKUP on Qgis between the ...
  • 87
0 votes
2 answers
102 views

Regexp_replace a number only when appears alone [closed]

I want to use regexp_replace expression to replace some numbers within a expression, but only when this numbers appear alone. For exemple: If have the expression '1 and 2' I want it to replace for 'B3 ...
  • 87
2 votes
3 answers
265 views

Remove symbols from text with field calculator

I'm attempting to remove € symbols from values in the attributes of a geopackage. For example, I have a value 240 123€ that I want to turn into 240 123. I'm using the field calculator to do this. So ...
  • 382
5 votes
2 answers
230 views

QGIS Field Calculator - Remove text inside multipe parentheses from a string

On the QGIS Field calculator, I am trying to remove from a string the text that is inside parentheses using regexp_replace. While it is not a problem to remove the text from a string that contains ...
  • 3,719
4 votes
1 answer
142 views

Filter array with a field value

I need to filter filenames (like DJI_0147_3_5.jpg) in an array, and the code below works, but, where you see a 3 in regex, I need instead a field value. In the array output (sourcefile field) we have ...
0 votes
1 answer
107 views

QGIS Regex expression label

I'm trying to use regex expression to label my layer in order to show the parcel number. Here is some examples of what i'm looking for : From this "53042A0027/00M002", to "A27M/2" ...
2 votes
1 answer
49 views

MapInfo SQL Query with Metacharacters?

I have +8 million edge in MapInfo. I want to select character+digit but I can't. I tried querying as [a-z]+[0-9] but failed to use metacharacters in MapInfo. "New York 1. Street" is true. &...
  • 31
3 votes
2 answers
134 views

Allowing only numbers in table field and preventing saving anything else using shapefiles in QGIS

I have a shapefile in which I want to allow only numbers in a table field. For this I have inserted the following expression in Properties > Attribute Form> Constraints (see Screenshot). not ...
  • 561
5 votes
2 answers
135 views

QGIS defining the nth character where the label could be wrapped

I have the labels, which include a few of the same characters "/". Unfortunately, I cannot simply use the "Wrap on character" option, because it wraps everywhere where this ...
  • 3,663
2 votes
4 answers
95 views

QGIS regular expression while importing delimited text

I have a CSV file with following format : UTC,Callsign,Position,Altitude 2021-05-11T11:44:38Z,FABCD,"28.084,7.452",500 ... So I can't import with personalized delimiters. I tried to use ...
  • 1,023
5 votes
2 answers
442 views

Replacing '.' and '-' in column values with empty space '' in QGIS

I have a shapefile that has a column named "SBL" with string values that contain points (.) and hyphens (-). However, I want to remove these points and hyphens, but so far I haven't been ...
0 votes
1 answer
284 views

Removing repeated commas with ArcGIS Survey123

I have created a form in ArcGIS Survey123. I have several field where you can enter multiple numbers from a select_multiple question. I then want to put all of those numbers into a single string. So I ...
2 votes
1 answer
429 views

Regex to replace English Characters to Arabic by QGIS

I have a challenge to replace English content which comes from AutoCAD annotation to Arabic characters, Arabic fonts for AutoCAD like xarab store Arabic content as English, I just need to replace ...
  • 1,093
3 votes
1 answer
893 views

Removing part of string from the right in QGIS

I am trying to remove the last piece of my string in QGIS. I want to delete the E10 from the end. I tried both: How to easily edit attribute data using Regular Expressions? regexp_replace("UPRN&...
  • 3,663
1 vote
1 answer
251 views

Finding and replacing coordinates in GeoJSON

I have converted kml files to GeoJSON strings. These represent polygons that are often not closed. I want to enforce their closing by searching for the first lat/lon coordinate in the string, checks ...
3 votes
2 answers
261 views

Replacing HTML links in attribute table Field Calculator in QGIS

I am having trouble doing a simple replace of a string in QGIS attribute table field calculator. My table has a field "tbljoined_link" that contains HTML links like <a href='islands/luzon....
  • 912
0 votes
1 answer
214 views

Creating integer field from string with characters in QGIS

I am trying to create a new attribute field in a layer that converts a string with characters into an integer. EXAMPLE: 234' -> 234 or 234'* -> 234 Any ideas on how to accomplish this?
  • 195
3 votes
3 answers
983 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 ...
  • 7,894
2 votes
1 answer
754 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 ...
3 votes
5 answers
397 views

Extracting digits from string in QGIS

I have a string field that I want to extract only the digits example: 1,500 m2 -> 1500 I've tried with regexp_substr("location", '(\\d*)') to remove all after the blank space, but I need ...
2 votes
3 answers
441 views

Rasterize: burning string values into raster (string to real) (QGIS)

I have to rasterize a polygon layer. Unfortunately the values of the field I have to burn into the raster has a variety of string entry's like "L239x" or "a403" (case sensitive!). RAT (Raster ...
  • 7,985
1 vote
1 answer
365 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).
2 votes
2 answers
1k 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 ...
  • 7,894
3 votes
1 answer
234 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 ...
  • 53
0 votes
1 answer
780 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 ...
  • 7,894
3 votes
1 answer
436 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 ...
  • 7,894
0 votes
1 answer
108 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 ...
  • 7,894
3 votes
1 answer
4k 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
2 answers
198 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. ...
  • 7,894
0 votes
3 answers
3k 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}...
3 votes
0 answers
824 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
1 answer
103 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
1 answer
607 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,167
3 votes
1 answer
171 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 ...
  • 33
1 vote
1 answer
907 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/...
3 votes
1 answer
210 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,728
7 votes
2 answers
3k 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 ...
  • 1,433
3 votes
1 answer
312 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 ...
  • 7,894
2 votes
1 answer
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 ...
  • 655
2 votes
0 answers
610 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) && ([...
  • 1,674
3 votes
1 answer
317 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 ...
3 votes
3 answers
564 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
2 answers
744 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
1 answer
689 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 ...
  • 4,324
2 votes
1 answer
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 ...
  • 23