I am working on a Swift project and I need to use this regex to check email is valid or not but when the app start the checking the app crash and give me this error:
NSInternalInconsistencyException', reason: 'Can't do regex matching, reason: Can't open pattern U_REGEX_MISSING_CLOSE_BRACKET
This is my REGEX:
^(([^<>()[\\]\\.,;:\\s#\\\"]+(\\.[^<>()[\\]\\.,;:\\s#\\\"]+)*)|(\\\".+\\\"))#((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+[\\.]*)+[a-zA-Z]{2,}))$
Check unescaped brackets in your regex pattern:
let pattern
= "^(([^<>()[\\]\\.,;:\\s#\\\"]+(\\.[^<>()[\\]\\.,;:\\s#\\\"]+)*)|(\\\".+\\\"))"
// [ [ ] [ [ ]
+ "#((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+[\\.]*)+[a-zA-Z]{2,}))$"
// [ ] [ ] [ ] [ ] [ ] [ ] [ ]
You have some mismatching brackets [ ] in the first half of your pattern.
In some dialects of regex, you have no need to escape [ between [ and ], but in some other dialects, you need it.
Try adding some escapes to your regex:
let pattern
= "^(([^<>()\\[\\]\\.,;:\\s#\\\"]+(\\.[^<>()\\[\\]\\.,;:\\s#\\\"]+)*)|(\\\".+\\\"))"
// [ ^^ ] [ ^^ ]
+ "#((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+[\\.]*)+[a-zA-Z]{2,}))$"
// [ ] [ ] [ ] [ ] [ ] [ ] [ ]
Related
manualChunks: {
'#dnd-kit/core': [
'#dnd-kit/core',
'#dnd-kit/sortable',
'#dnd-kit/utilities',
],
'#radix-ui/react-collapsible': [
'#radix-ui/react-collapsible',
'#radix-ui/react-dropdown-menu',
'#radix-ui/react-navigation-menu',
],
react: ['react', 'react-dom'],
'react-aria': [
'#react-aria/checkbox',
'#react-aria/dialog',
'#react-aria/focus',
'#react-aria/meter',
'#react-aria/visually-hidden',
'#react-aria/utils',
'#react-aria/tooltip',
'#react-aria/overlays',
'#react-aria/radio',
],
'react-stately': [
'#react-stately/radio',
'#react-stately/toggle',
'#react-stately/checkbox',
],
slate: [
'#contra/slate',
'slate',
'slate-react',
'slate-history',
'slate-hyperscript',
],
'stream-chat': ['stream-chat', 'stream-chat-react'],
stripe: ['#stripe/react-stripe-js', '#stripe/stripe-js'],
visx: [
'#visx/curve',
'#visx/event',
'#visx/gradient',
'#visx/responsive',
'#visx/scale',
'#visx/shape',
'#visx/tooltip',
],
},
The above is my rollupjs manualChunk configuration.
Based on this configuration, I would expect to have several chunks that group together these dependencies.
However, almost everything ends up in stream-chat chunk.
What's happening and how do I achieve the desired result?
As described here, Pandoc records Synctex-like information when the source is commonmark+sourcepos. For example, with this commonmark input,
---
title: "Sample"
---
This is a sample document.
the output in native format starts like this:
Pandoc
Meta
{ unMeta =
fromList [ ( "title" , MetaInlines [ Str "Sample" ] ) ]
}
[ Div
( "" , [] , [ ( "data-pos" , "Sample.knit.md#5:1-6:1" ) ] )
[ Para
[ Span
( ""
, []
, [ ( "data-pos" , "Sample.knit.md#5:1-5:5" ) ]
)
[ Str "This" ]
, Span
( ""
, []
, [ ( "data-pos" , "Sample.knit.md#5:5-5:6" ) ]
)
[ Space ]
, Span
( ""
, []
, [ ( "data-pos" , "Sample.knit.md#5:6-5:8" ) ]
)
[ Str "is" ]
but all that appears in the .tex file is this:
{This}{ }{is}...
As a step towards Synctex support, I'd like to insert the data-pos information as LaTeX markup, i.e. change the .tex output to look like this:
{This\datapos{Sample.knit.md#5:1-5:5}}{ \datapos{Sample.knit.md#5:5-5:6}}{is\datapos{Sample.knit.md#5:6-5:8}}...
This looks like something a Lua filter could accomplish pretty easily: look for the data-pos records, copy the location information into the Str record. However, I don't know Lua or Pandoc native language. Could someone help with this? Doing it for the Span records would be enough for my purposes. I'm using Pandoc 2.18 and Lua 5.4.
Here is an attempt that appears to work. Comments or corrections would still be welcome!
Span = function(span)
local datapos = span.attributes['data-pos']
if datapos then
table.insert(span.content, pandoc.RawInline('tex', "\\datapos{" .. datapos .. "}"))
end
return span
end
I am new to shell scripting and I want to print the IPs inside current cidr range and proposed cidr range below is the output
{
"acknowledgeRequiredBy": xxxxxx000,
"acknowledged": false,
"acknowledgedBy": "name#email.com",
"acknowledgedOn": xxxxxx00000,
"contacts": [
"dl#email.com",
"dl2#gmail.com"
],
"currentCidrs": [
"1.2.3.4/24",
"5.6.7.8/24",
"9.10.11.12/24",
"13.14.15.16/24",
"17.18.19.20/24",
"21.22.23.24/24",
"25.26.27.28/24",
],
"id": 1x4x3xx,
"latestTicketId": 0000,
"mapAlias": "sample name",
"mcmMapRuleId": 111xxx,
"proposedCidrs": [
"25.26.27.28/24",
"1.2.3.4/24",
"5.6.7.8/24",
"9.10.11.12/24",
],
"ruleName": "namerule.com",
"service": "S",
"shared": na,
"sureRouteName": "example",
I want the output as only the IPs please help me with the logic
I have two array of Integers and I like to send it to my mongodb database. When I send it to database in Alamofire as paramter and in code data_array 1 and 2 refers to Int arrays.
let parameters_post: Parameters = [
"sensor_id": "ecg_raw",
"member_id": "58d3f509e48f4ca90dd218e4",
"esignal": "3.5V",
"ts": "emre",
"value1" : data_array1,
"value2" : data_array2
]
Alamofire.request("https://api.mlab.com/api/1/databases/mysignal/collections/Cecgraw?apiKey=2ABdhQTy1GAWiwfvsKfJyeZVfrHeloQI", method: .post, parameters: parameters_post,encoding: JSONEncoding.default, headers: nil).responseData{ response in
print(response.request)
print(response.response)
print(response.result)
}
However, It is seen as like this in mongodb. I think which is incorrect;
{
"_id": {
"$oid": "58f9d0e7c2ef162ad3000cb6"
},
"sensor_id": "ecg_raw",
"member_id": "58d3f509e48f4ca90dd218e4",
"value2": [
[
240,
279,
555,
547,
504
]
],
"value1": [
[
135,
91,
101,
115,
106
]
],
"esignal": "3.5V",
"ts": "emre"
}
As per you said you want to send value for key value as [(Int, Int)]. But actually you are sending as [[(Int, Int)]], which means array of array of tuples(Hope you need to send as array of tuples).
Try to send list below,
let parameters_post: Parameters = [
"sensor_id": "ecg_raw",
"member_id": "58d3f509e48f4ca90dd218e4",
"esignal": "3.5V",
"ts": "emre",
"value" : data_array
]
Thanks.
I am pretty new in swift and trying to make a http post request calling an api.while it works just fine on postman
Here is the JSON string i need post backend as an httpBody.
myJSON ={"address1":"Mirpur","address2":"D6, f8","cellPhone":"01852540565","city":"fghff","countryName":"Bangladesh","orderDate":"2017-02-25T11:28:24","orderStatus":1,"orderedProductList":[{"discount":0.0,"orderDetailId":0,"price":30000.0,"quantity":1,"shippingCharge":50.0,"supplierId":0,"tax":0.0,"type":{"isBook":false,"typeId":0},"productId":5,"productViews":0},{"discount":0.0,"orderDetailId":0,"price":50000.0,"quantity":1,"shippingCharge":50.0,"supplierId":0,"tax":0.0,"type":{"isBook":false,"typeId":0},"productId":8,"productViews":0},{"discount":0.0,"orderDetailId":0,"price":2000.0,"quantity":1,"shippingCharge":50.0,"supplierId":0,"tax":0.0,"type":{"isBook":false,"typeId":0},"productId":9,"productViews":0}],"paymentTransactionId":"1215455638874521","state":"fyy","zip":"4525","countryId":23,"orderId":0,"orderTotal":82000.0,"paymentMethodId":1,"userId":0}
Any idea how to fix this and it will be extremely helpful.
Thanks
Using the syntax #deadbeef suggested should work, such as this reformatted myJSON:
let myJSON: [String : Any] = ["address1":"Mirpur",
"address2":"D6, f8",
"cellPhone":"01852540565",
"city":"fghff",
"countryName":"Bangladesh",
"orderDate":"2017-02-25T11:28:24",
"orderStatus":1,
"orderedProductList":[
["discount":0.0,
"orderDetailId":0,
"price":30000.0,
"quantity":1,
"shippingCharge":50.0,
"supplierId":0,
"tax":0.0,
"type":[
"isBook":false,
"typeId":0
],
"productId":5,"productViews":0
],
["discount":0.0,
"orderDetailId":0,
"price":50000.0,
"quantity":1,
"shippingCharge":50.0,
"supplierId":0,"tax":0.0,
"type":[
"isBook":false,
"typeId":0
],
"productId":8,
"productViews":0
],
["discount":0.0,
"orderDetailId":0,
"price":2000.0,
"quantity":1,
"shippingCharge":50.0,
"supplierId":0,"tax":0.0,
"type":[
"isBook":false,
"typeId":0
],
"productId":9,
"productViews":0
]
],
"paymentTransactionId":"1215455638874521",
"state":"fyy",
"zip":"4525",
"countryId":23,
"orderId":0,
"orderTotal":82000.0,
"paymentMethodId":1,
"userId":0]