regexp-replace

Autohotkey and Windows 10: How to get current explorer path

Deadly 提交于 2019-12-23 05:11:45
问题 I use autohotkey version: 1.0.48.05 (because I stick with activeaid). The script to read the current path is as follows (and worked until Win 7). ; Get full path from open Explorer window WinGetText, FullPath, A ; Clean up result StringReplace, FullPath, FullPath, `r, , all FullPath := RegExReplace(FullPath, "^.*`nAddress: ([^`n]+)`n.*$", "$1") How I suspect that while switching to Win10 it seems that I also switched the language. If I MsgBox out the %FullPath% before cleaning with WinGetText

Strange behaviour of Regexp_replace in a Hive SQL query

末鹿安然 提交于 2019-12-19 11:52:54
问题 I have some input information where I'm trying to remove the part .0 from my input where an ID string ends with .0 . select student_id, regexp_replace(student_id, '.0','') from school_result.credit_records where student_id like '%.0'; Input: 01-0230984.03 12345098.0 34567.0 Expected output: 01-0230984.03 12345098 34567 But the result I'm getting is as follows: It's removing any character having with a 0 next to it instead of removing only the occurrences that end with .0 0129843 123498 34567

How to remove duplicates from comma separated list by regex in Oracle but I don't want duplicates values? [duplicate]

a 夏天 提交于 2019-12-17 21:20:07
问题 This question already has answers here : How to remove duplicates from space separated list by Oracle regexp_replace? [duplicate] (3 answers) How to remove duplicates from comma separated list by regexp_replace in Oracle? (2 answers) Closed last year . I have this string ABCD1234, XYZ, ABCD1234, ABCD1234C, ABCD1234, abc, abcX, 1234U, 1234 and I want, but I don't want duplicates values ABCD1234, XYZ, ABCD1234C, abc, abcX, 1234U, 1234, I'm using below regex select regexp_replace ( 'ABCD1234,

Laravel preg_match(): No ending delimiter '/' found

断了今生、忘了曾经 提交于 2019-12-17 05:07:20
问题 Im working on Laravel 4.2. Im trying to use Validator to validate a name field with regex, here is my rule below: public static $rules_save = [ 'class_subjects' => 'required|regex:/[0-9]([0-9]|-(?!-))+/' ]; But as soon as I call the rule to be validated an error is thrown, see below: preg_match(): No ending delimiter '/' found 回答1: Since your regex has a pipe in it, you have to use an array: public static $rules_save = [ 'class_subjects' => ['required', 'regex:/[0-9]([0-9]|-(?!-))+/'], ];

Remove numbers found in string column

ぐ巨炮叔叔 提交于 2019-12-13 05:49:47
问题 What would be the SQL to remove all numbers found in an otherwise string column using Sqlite (an Oracle example would be appreciated too)? Example : I would like to remove all numbers from entries like this : 291 HELP,1456 CALL Expected output: HELP,CALL edit: I have edited the question because it is not only from one entry that I want to remove numbers but many of them. 回答1: Either you do it in the language, you embedded sqlite, or you use this SQLite code, that removes all numbers: UPDATE

How to REGEXP_REPLACE special character

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 14:55:23
问题 I am having issue with following regex select REGEXP_REPLACE(declinereasondesc, '(.+)(£)(\d+)', '\1\3 (GBP)') as r from DECLINEREASON t it does not match following rows Too expensive : By less than £100 Too expensive : By more than £200 Expected outcome Too expensive : By less than 100 (GBP) Too expensive : By more than 200 (GBP) EDIT: screenshot for non-believers 回答1: Figured it out myself problem is £ as I am sure everyone suspected Solution contains two steps first is to get symbol code,

replace multiple line breaks with one new line charatcer in oracle server using REGEXP_REPLACE

元气小坏坏 提交于 2019-12-11 03:37:41
问题 How to replace multiple line breaks with one new line charatcer in oracle server using REGEXP_REPLACE. 回答1: I think this is what you are after. Dealing with carriage returns can get tricky depending if you are on Windows or UNIX but you'll get the idea. This was run in Toad, which uses a regular expression which looks for occurrences of two or more newline characters in a row and replaces them with one newline. 来源: https://stackoverflow.com/questions/32518929/replace-multiple-line-breaks-with

Postgresql: removing spaces between certain type of digits

蹲街弑〆低调 提交于 2019-12-11 03:34:09
问题 I have a column with address such as '01031 970 São Paulo SP, BR' . I want to remove spaces between postal codes. The postal code can appear anywhere in the address, e.g. 'São Paulo 01031 970 SP, BR' . The result should be 'São Paulo 01031970 SP, BR' or '01031970 São Paulo SP, BR' regexp_replace(address, ,'(\s*[0-9]{5}\s+[0-9]{3}\s+)','(\s*[0-9]{5}[0-9]{3}\s+)', 'g') obviously does not work, but I am looking for an equivalent that does the job. 回答1: Try this query: update your_table set

Explain unexpected regexp_replace result

我们两清 提交于 2019-12-11 01:45:25
问题 I found an unexpected result when using regexp_replace to concatenate a string on the end of another string, as an exercise in using regexp_replace to do it. I bring it up to not only figure out why, but to let folks know of this possibly unexpected result. Consider this statement where the intent is to tack "note 2" on the end of string "Note 1". My intention was to group the entire line, then concatenate the new string to the end: select regexp_replace('note 1', '(.*)', '\1' || ' note 2')

Convert upper chars to lower and lower to upper (vice versa) [duplicate]

北慕城南 提交于 2019-12-08 17:58:26
问题 This question already has answers here : Swap Case on javascript (6 answers) Closed 4 years ago . I need to convert all lower characters to upper and all upper to lower in some string. For example var testString = 'heLLoWorld'; Should be 'HEllOwORLD' after conversion. What is the most elagant way to implement this, without saving temp string. I would be much more better if achieve such result using regular expressions. Thanks. 回答1: Here's a regular expression solution, which takes advantage