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
1 vote
1 answer
128 views

Replacing spaces between a number and its unit using regexp_replace [duplicate]

In QGIS attributes I have text strings that sometimes include a measurement as part of descriptions, "such as cut at 10 m". In order to make these look nice when presented in multiline fixed ...
Sethinacan's user avatar
  • 1,702
4 votes
2 answers
296 views

Capturing all matches (occurences) with QGIS regular expressions

Problem I use QGIS with the expression function regexp_matches() that returns an array of all strings captured by capturing groups. Regular expressions normally capture only the first match (occurence)...
Babel's user avatar
  • 70.4k
2 votes
1 answer
100 views

Extracting or selecting only 4 digit numbers from attribute field

I have a field, this field has integer numbers, what I need is to find only the 4 digit numbers and select/extract them. I do know a few solutions but they didn’t work out. What exactly I want to do ...
John's user avatar
  • 21
1 vote
0 answers
107 views

Domain in gpkg QGIS

I try to set the field domain for GeoPackage table fields. (description in : see qgis changelog) I want but I can't use glob domain (with regex constraint), I try many syntax in pattern : '[A-Z]' , &...
pasqal's user avatar
  • 506
0 votes
1 answer
47 views

Regex substr - Extracting number after specific text sequence

Couldn't find any solution to a specific sequence. Context: italian cadaster, where plot number is embedded in a table coded in kml, in the "description" field. I want to extract the plot ...
Gilles's user avatar
  • 395
3 votes
1 answer
252 views

Split a text string with each character as an element of an array with QGIS expressions and regular expressions

I want to use QGIS expressions to split up a text string to an array with each element representing one character of the input's string, like: input: mytext -> ouput: [ 'm', 'y', 't', 'e', 'x', 't' ...
Babel's user avatar
  • 70.4k
0 votes
2 answers
197 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:
Bruno B's user avatar
  • 839
2 votes
2 answers
253 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 : `~!@#$%^&*_{}[]<>?/ ...
Bruno B's user avatar
  • 839
5 votes
1 answer
255 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') ...
Bruno B's user avatar
  • 839
3 votes
2 answers
297 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) ...
Bruno B's user avatar
  • 839
2 votes
4 answers
472 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. ...
enor's user avatar
  • 391
0 votes
0 answers
32 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 ...
Rui's user avatar
  • 97
0 votes
2 answers
195 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 ...
Rui's user avatar
  • 97
2 votes
3 answers
335 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 ...
enor's user avatar
  • 391
5 votes
2 answers
411 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 ...
Val P's user avatar
  • 3,858
4 votes
1 answer
294 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 ...
fausto ugozzoli's user avatar
0 votes
1 answer
148 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" ...
Florian Marlière's user avatar
2 votes
1 answer
84 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. &...
saroman's user avatar
  • 43
4 votes
2 answers
252 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 ...
Omegon's user avatar
  • 601
5 votes
2 answers
214 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 ...
Geographos's user avatar
  • 4,077
2 votes
4 answers
153 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 ...
dmjf08's user avatar
  • 1,233
5 votes
2 answers
706 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 ...
Kaveh Ekbia's user avatar
0 votes
1 answer
541 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 ...
OwlExpression's user avatar
2 votes
1 answer
586 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 ...
GIS Man's user avatar
  • 1,113
3 votes
1 answer
2k 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&...
Geographos's user avatar
  • 4,077
1 vote
1 answer
378 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 ...
GIStrees's user avatar
  • 119
3 votes
2 answers
318 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....
JAT86's user avatar
  • 922
0 votes
1 answer
287 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?
sudofizz's user avatar
  • 195
3 votes
3 answers
1k 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 ...
GeorgeC's user avatar
  • 8,196
2 votes
1 answer
1k 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 ...
Nick Carraway's user avatar
3 votes
5 answers
767 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 ...
Juan Millan's user avatar
2 votes
3 answers
699 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 ...
MartinMap's user avatar
  • 8,284
9 votes
4 answers
3k views

Use field calculator QGIS: if value in one column, then value in new column

I am having troubles using the field calculator to get what I want. One column in my attribute table is named 'Taxa' and has a set of species in it. Species are separated by #. I want to make a new ...
Stevestingray's user avatar
1 vote
1 answer
536 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).
David Galt's user avatar
4 votes
2 answers
2k 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 ...
GeorgeC's user avatar
  • 8,196
3 votes
1 answer
281 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 ...
hhart4's user avatar
  • 53
0 votes
1 answer
1k 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 ...
GeorgeC's user avatar
  • 8,196
3 votes
1 answer
542 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 ...
GeorgeC's user avatar
  • 8,196
0 votes
1 answer
116 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 ...
GeorgeC's user avatar
  • 8,196
3 votes
1 answer
5k 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] ...
M Reaume's user avatar
0 votes
2 answers
237 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. ...
GeorgeC's user avatar
  • 8,196
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}...
Gary Lester's user avatar
3 votes
0 answers
996 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....
Senyo Aborgah's user avatar
2 votes
1 answer
109 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, ...
Demi Vonk's user avatar
4 votes
1 answer
759 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 ...
Bernd V.'s user avatar
  • 3,179
3 votes
1 answer
181 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 ...
Craig's user avatar
  • 33
1 vote
1 answer
999 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/...
Timbo284's user avatar
4 votes
2 answers
337 views

Moving substring from end to beginning of string in QGIS Attribute table

I have a large data set that contains a time range in the format 00:00-00:00 and 1-6 three-day abbreviations of days of the week (MON, TUE, WED, etc.). I managed to get all the time ranges and day ...
S. Signs's user avatar
3 votes
1 answer
221 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 ...
Thomas B's user avatar
  • 8,787
8 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 ...
jamierob's user avatar
  • 1,549