Questions tagged [rlike]

For issues relating to the RLIKE synonym for the REGEXP MySQL operator.

RLIKE is a synonym for the REGEXP MySQL operator. It performs a pattern match of a string expression against a pattern. The pattern is supplied as an argument.

Sample:

SELECT 'Michael!' REGEXP '.*';
64 questions
1
vote
2 answers

Negating specific line end sequences in rlike regex

I want to match any line that does not end with 'CA' or 'CA[any number]'. How can I do that using rlike in MySQL? (Note it doesn't support ?! etc). Here's the regex for a positive match, I just need a way to negate it: '^.*[C][A][0-9]?$' (Due to…
Greg
  • 45,306
  • 89
  • 231
  • 297
1
vote
1 answer

Mysql Rlike condition

I have a table name company Company | category_id NEC | cg17,cg19,cg23 Huawei | cg55,cg17,cg25 Which I query like this: select * from company where category_id RLIKE '^cg17,cg19' with result: Company | category_id NEC | …
Maestro Vladimir
  • 1,186
  • 4
  • 18
  • 38
1
vote
1 answer

MySQL REPLACE string with regex

I have a table with about 50,000 records. One of the fields is a "imploaded" field consisting of variable number of parameters from 1 to 800. I need to replace all parameters to 0. Example: 1 parameter 3.45 should become 0.00 2 parameters …
user1786605
  • 63
  • 1
  • 1
  • 7
1
vote
1 answer

Need MySQL RLIKE expression to exclude certain strings ending in particular characters

So I've been working with RLIKE to pull some data in a new application and mostly enjoying it. To date I've been using RLIKE queries to return 3 types of results (files, directories and everything). The queries (and example results)…
zmg
  • 127
  • 2
  • 6
0
votes
0 answers

Case when RLIKE

I'm trying to write case when which checks if specific column values are containing certain logic. CASE WHEN 111 AND ((LENGTH(222) != 10) OR (LENGTH(222) = 10 AND NOT (( 222 RLIKE '[0-9]') OR (222 RLIKE…
0
votes
0 answers

pyspark dataframe Column with Decimal(38,10) with scientific notation how to find regex

I am using below line to check for numbers when(df[COL_VALUE_DEC].rlike("^[0-9.]+$"), 1) and datatype of column COL_VALUE_DEC is DECIMAL(38,10) When the value is 0 in this column, pyspark is returning it as 0E-10 and thus it is not matching the…
Vrishank
  • 302
  • 4
  • 22
0
votes
1 answer

snowflake stored procedure with special characters not working

I want to identify the phone number is in correct format or not. e.g. format. (XXX) XXX-XXXX Here is the SQL that is working fine select RLIKE( '(800) 456-7891', '\\([0-9]{3}\\) [0-9]{3}-[0-9]{4}'); But when tried to replicate this function inside…
0
votes
1 answer

SQL statement for column value that matches both regex

The table "article" has a cloumn named "A_Title". I want to select the A_Title that matches exactly both /[A-Za-z]+/ and /[\x{0981}-\x{09E3}]/u regex at the same time. I tried several methods for it, but neither is working. Giving error: #1139 - Got…
Rains
  • 29
  • 4
0
votes
1 answer

Spark regex 'COIN' in column values -> rlike approach

I would like to check if the column values contains 'COIN' etc. in values. Is there a possibility to change my regex so as not to include "CRYPTOCOIN|KUCOIN|COINBASE"? I'd like to have something like "regex associated with COIN…
sk306
  • 29
  • 4
0
votes
1 answer

AttributeError: 'NoneType' object has no attribute '_jvm' in Pyspark

I'm trying to print a dataframe by looping through each row of that dataframe. I then used the map() transformation to the dataframe's RDD to apply lambda function and tried converting it back into a dataframe. I'm running this program on Jupyter…
AAA6
  • 67
  • 3
  • 9
0
votes
1 answer

rlike() function in pyspark is not working properly

I trying to use rlike() to the money [whether it has dollar sign( $) , comma ( ,) , decimal sign(.) and numbers before and after the decimal sign also there can be a negative sign before / after the $ sign) Below is the regex expression i came up…
Vaishnavi S
  • 25
  • 1
  • 5
0
votes
2 answers

MYSQL REGEXP_SUBSTR: get string or ip out of text

I struggle through a complex query and need help with a REGEXP_SUBSTR command being used in the WHERE CLAUSE: In deed this are two questions. given three possible records, I want to get the part between the brackets, but only if they match…
Markus N.
  • 312
  • 2
  • 7
0
votes
2 answers

PySpark Return Exact Match from list of strings

I have a dataset as follows: | id | text | -------------- | 01 | hello world | | 02 | this place is hell | I also have a list of keywords I'm search for: Keywords = ['hell', 'horrible', 'sucks'] When using the following solution using .rlike() or…
Smithy
  • 39
  • 4
0
votes
1 answer

How to use RLIKE AND regular expression in case insentive

I try to only query lowercase results but LIKE is not case insensitive. Here is an example: SELECT CITY FROM TARGETS WHERE CITY RLIKE '^b.*n$' the result is BOSTON boston I want to only keep the 'boston', but I don't know how to do it.…
Carlos
  • 167
  • 1
  • 2
  • 14
0
votes
1 answer

Exclude certain strings while including others using RLIKE

I'm working on a Snowflake query that uses the RLIKE function to find certain words in a block of text. This is a simplified version of my query: SELECT id FROM table WHERE RLIKE (text,'.* red .*|.* green .*|.* blue .*','i') Some examples of the…
dhae123
  • 3
  • 2