Questions tagged [nsregularexpression]

The NSRegularExpression class is used to represent and apply regular expressions to Unicode strings. An instance of this class is an immutable representation of a compiled regular expression pattern and various option flags. The pattern syntax currently supported is that specified by ICU. iOS 4.0+ macOS 10.7+

This class in the Apple developer library (Mac OS X, iOS) is used to represent and apply regular expressions to Unicode strings.

NOTE: This tag should be used only for questions specific to the NSRegularExpression class. Questions about regular expressions in general should be tagged .

643 questions
-2
votes
3 answers

One uppercase letter validation regex

I am working on a regex validation for an alphanumeric character with a length of 4 but contains only one Uppercase letter. This is the code I have: NSRegularExpression *expression = [NSRegularExpression…
jafar
  • 51
  • 1
  • 4
-2
votes
1 answer

How to Skip Content from a tag while regex search?

Possible Duplicate: RegEx match open tags except XHTML self-contained tags I have a string which is html like this

this is sample content

this is another sample

Hulk
  • 217
  • 1
  • 5
  • 24
-3
votes
0 answers

How to search for a group of numbers via regular expressions

I need to extract all numbers using regex from a string which can contains numbers including , or . and also it can contains both. e.g hello + 2,3.0 + hello - 2.3 + 2,3 So it should return 2,3.0 2.3 2,3
-3
votes
2 answers

Regular expression (regex) help: Need to delete everything on several lines after an IP address

I have several lines that are 192.168.86.3 0x1 0x2 3cbbaxrad * br-lan 192.168.86.213 0x1 0x2 3cccfargarad * br-lan 192.168.86.51 0x1 0x2 3cccfcvrad * br-lan 192.168.86.11 0x1 0x2 3cccfxxrad * br-lan I need to extract…
-3
votes
1 answer

regular expression to delete separator and text after separator

I am looking for a regular expression which removes text after a separator and removes the separator as well. I tried .*& to remove text after &. This is working but I want to remove & from my string as well. Like &, I have multiple other…
uttara
  • 25
  • 1
  • 1
  • 4
-3
votes
1 answer

What sort of regex is this?

I just found someone using a regex like this: NSString *pattern = @"i[\\p{Alphabetic}&&\\p{Uppercase}][\\p{Alphabetic}]+"; [NSRegularExpression regularExpressionWithPattern:pattern options:0 error:NULL]; // Source:…
Khanh Nguyen
  • 10,636
  • 9
  • 47
  • 62
-3
votes
3 answers

How to replace strings using regex in objective C?

I have a string that sometimes contains strings like: @"[id123123|Some Name]" What I have to do, is to simply replace it to "Some Name" For example I have string: Some text lalala blabla [id123|Some Name] bla bla bla And I need to get: Some text…
Didar1994
  • 9
  • 5
-3
votes
2 answers

Remove Optional() from Swift string using Regular Expressions

I've a string having 'Optional(someVal)' in it. I want a regular expression to find and replace all occurrences of this keyword and replace just inside values in it. What I'm doing is... query = "Insert Into table (Col, Col, Col, Col, Col, Col4,…
Saad
  • 8,501
  • 2
  • 36
  • 49
-3
votes
2 answers

Regular Expression for &Anyword=

What would be a regular expression for &Anyword= I need find the occurrence of this expression and replace it with some other template but i need to retain "Anyword" between "&" and "=".
chandvoid
  • 113
  • 1
  • 11
-4
votes
1 answer

Regex to match anchor tag and its href

I want to run regex through a html string that has multiple anchor tags and construct a dictionary of link text vs its href url.

This is a simple text with some embedded

Nagendra Rao
  • 6,406
  • 5
  • 47
  • 87
-4
votes
2 answers

regex to get "words" delimited by space(s)?

What would the regex be (to be used in IOS, "NSRegularExpression") to get the "words" from a string delimited by a space(s), i.e. could be " ", or " ", or " " etc as the delimited. So therefore: "26:43:33 S 153:02:51 E" Would…
Greg
  • 31,898
  • 75
  • 232
  • 424
-4
votes
1 answer

Extract number(amount of money) from a sentence in iOS

I need to extract out the amount from the sentences containing amount information like "Rs 500". E.g => "Product costs Rs 500, would you like to buy???", I need the solution in regex, please share the code using NSRegularExpression class to extract…
Ashwani
  • 328
  • 1
  • 3
  • 11
1 2 3
42
43