regex

Extract float from String/Text SQL Server

僤鯓⒐⒋嵵緔 提交于 2021-01-28 02:55:03
问题 I have a Data field that is supposed to have floating values(prices), however, the DB designers have messed up and now I have to perform aggregate functions on that field. Whereas 80% of the time data is in correct format,eg. '80.50', sometime it is saved as '$80.50' or '$80.50 per sqm'. The data field is nvarchar. What I need to do is extract the floating point number from the nvarchar. I came accross this: Article on SQL Authority This, however, solves half my problem, or compound it, some

3 out of 4 conditions in regex java [duplicate]

余生长醉 提交于 2021-01-28 02:30:57
问题 This question already has answers here : The best way to match at least three out of four regex requirements (2 answers) Closed 11 months ago . I am trying to create a java to check strength of a password with regex. The password must pass 3 out of 4 conditions: lowercase uppercase contains digits has special characters The code looks like below: import java.util.*; public class StringPasswordStrength { public static void main(String[] args) { Scanner input = new Scanner(System.in); System

RegExp - find all occurences, but not inside quotes

こ雲淡風輕ζ 提交于 2021-01-28 02:18:40
问题 I have this text (it's a string value, not a language expression): hello = world + 'foo bar' + gizmo.hoozit + "escaped \"quotes\""; And I would like to find all words ( [a-zA-Z]+ ) which are not enclosed in double or single quotes. The quotes can be escaped ( \" or \' ). The result should be: hello, world, gizmo, hoozit Can I do this using regular expressions in JavaScript? 回答1: you can use this pattern, what you need is in the second capturing group: EDIT: a little bit shorter with a

How to remove a line of text in a string in CMake, working around CMake's lack of line-based regex matching?

爱⌒轻易说出口 提交于 2021-01-28 02:04:25
问题 I found out that CMake doesn't do RegEx the way I expected. Apparently, others have had this same problem as well. The issue is that CMake is not line-based. When you use the ^ or the $ operators, they work against the entire string, not the start and end of a line. I'm trying to remove all the lines in a file that say #include <blah.h> or #include "blah.h" . To do so, I whipped up a little function: function(deleteinplace IN_FILE pattern) file(READ ${IN_FILE} CONTENTS) string(REGEX REPLACE $

Regex pulling IP and port from string

此生再无相见时 提交于 2021-01-28 02:01:22
问题 I'm using Perl to try and pull the IP address and port from a string. The regex I'm trying to use is: s/(sip:)(;.*)// The strings are: sip:255.255.255.255:8080;transport=TCP sip:255.255.255.255:8080 Obviously my regex replace is not working. Can anyone point me to how I would need to write the regex? From those two strings I want to pull this: 255.255.255.255:8080 Meaning the regex needs to match anything that's not that string and replace it with nothing. Note: IP address and port will be

MongoDb Spring find in nested object

你。 提交于 2021-01-28 02:00:59
问题 I'm using Spring Data Mongodb and documents like this : { "_id" : ObjectId("565c5ed433a140520cdedd7f"), "attributes" : { "565c5ed433a140520cdedd73" : "333563851" }, "listId" : ObjectId("565c57aaf316d71fd4e4d0a0"), "international" : false, "countryCode" : 33, "deleted" : false } I would like to query my collection to search a value in the attributes object (in the values and not the keys). For example like this : @Query("{'listId': ?0, $or: [{'attributes.*':{$regex: ?1}}], 'deleted':false}")

php string validation for basiclatin and 1supplement

怎甘沉沦 提交于 2021-01-28 02:00:47
问题 I have an xml schema where a description is defined like this: [\p{IsBasicLatin}\p{IsLatin-1Supplement}]{1,1000} and i have to check in PHP that the user input string is valid for this encoding. Checking for the length is easy, but i don't find a way to use preg_match to check for basic latin. I've tried: preg_match('@^\p{IsBasicLatin}+@^\p{IsLatin-1Supplement}+$@u', $string); but it says that there's an unknown property, even using basicLatin or Latin. 回答1: The pattern \p{IsBasicLatin}

Break out of replace global loop

做~自己de王妃 提交于 2021-01-28 01:33:44
问题 I have a RegExp, doing a string replace, with global set. I only need one replace, but I'm using global because there's a second set of pattern matching (a mathematical equation that determines acceptable indices for the start of the replace) that I can't readily express as part of a regex. var myString = //function-created string myString = myString.replace(myRegex, function(){ if (/* this index is okay */){ //!! want to STOP searching now !!// return //my return string } else { return

Web Scraper抓取扇贝单词

橙三吉。 提交于 2021-01-28 01:13:37
最近背单词, 发现扇贝单词效率太低了, 然后想办法将扇贝单词抓出来, 导入到其他背单词的软件里, 比如知米 使用Web Scraper 插件搞定: {"_id":"shanbay","startUrl":["https://web.shanbay.com/wordsweb/#/words-table"],"selectors":[{"id":"NotLearn","type":"SelectorElementClick","parentSelectors":["_root"],"selector":"_root","multiple":false,"delay":2000,"clickElementSelector":"div#4 ","clickType":"clickOnce","discardInitialElements":"do-not-discard","clickElementUniquenessType":"uniqueText"},{"id":"word","type":"SelectorText","parentSelectors":["_root","page"],"selector":"div[class^='index_wordName']","multiple":true,"regex":"","delay":0},{"id":"page","type"

AngularJs ng-pattern regex

五迷三道 提交于 2021-01-28 01:12:59
问题 I am struggling writing a Regex for angular ng-pattern to validate a form input field.An example of the possible inputs are below Valid input: @tag1,@tag2,@tag3 @tag1, @tag2, @tag3 @tag1 Invalid Input: @tag 1 @tag 1, @tag2, @tag -3 @ta g1, @t ag2 Basically it should allow comma and comma whitespace, but not allow whitespace in between tags. I have written a REGEX that matches all the invalid input, but when I use this in ng-pattern it does not do the correct validation. Regex Built: /((^, @|@