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 .

722 questions
-2
votes
1 answer

why this regular expression match this?

I want to find the part which has a form like ( float), so I use the expression above. But it matchew with 'b' :(0, 2074.5), which is not what i think, because it has colon. To find the part which has only one float, how can i write my regular…
-2
votes
1 answer

Regular expression not working in iOS, works fine elsewhere

I have a regular expression to parse pod names from the CocoaPods podfile; I wrote this to be used as part of a vulnerability scan. This RegEx can be seen to be working in RegexR, as can be seen here. However, when used in NSRegularExpression, no…
Jacob King
  • 6,025
  • 4
  • 27
  • 45
-2
votes
2 answers

Java minus sign and hypen difference in regex

I am checking file names with a regex. File names can be format of customer name - company name I am using this regex: private static final Pattern fileRegex = Pattern.compile("^[a-zA-Z0-9_\\-\\.\\s\\,\\[\\]()\\{\\}]+$"); But hypen sign (minus…
-2
votes
2 answers

Regular expression string matching with string inside parenthesis

I have been facing an issue with regular expression string matching. Here is my string - var String detectionString = Stack Overflow (hello) I tried this regular expression test - \s(detectionString)\b but could succeed to match a string Stack…
Krunal
  • 77,632
  • 48
  • 245
  • 261
-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
  • 5
-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
  • 215
  • 1
  • 5
  • 24
-3
votes
2 answers

How to extract a numeric value from a line of text with a regular expression?

I'm new to regular expressions, help me extract the necessary information from the text: salespackquantity=1&itemCode=3760041","quantity_box_sales_uom" &salespackquantity=1&itemCode=2313441","quantity_box I need to take the numbers 3760041 and…
user16993750
-3
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
  • 7,016
  • 5
  • 54
  • 92
-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
  • 11,112
  • 10
  • 52
  • 65
-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,857
  • 2
  • 41
  • 51
-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
  • 133
  • 1
  • 12
1 2 3
48
49