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
2 answers

Extracting all overlapping substrings between nested matching parentheses with a .NET regex

I'm trying to parse mathematical expressions with nested brackets: (1 * (2 - 3)) + 4 I want to get every expression in brackets, like this: (1 * (2 - 3)) (2 - 3) Using this expression: (.*?\))(?=($|[^(]+)) I'm getting this result: (1 * (2 -…
2
votes
1 answer

Swift NSRegularExpression is too greedy

I have a regular expression that is supposed to allow me to annotate pieces of code within markdown documents. Basically it looks for content between /*HLS*/ and /*HLE*/ comments, and wraps that in a span. It even allows for a small explanation…
Kevin Renskers
  • 5,156
  • 4
  • 47
  • 95
2
votes
1 answer

regular expression

How do I write a regular expression to get that returns only the letters and numbers without the asterisks in between ?
Anna
  • 57
  • 5
2
votes
2 answers

Regex replace spaces at each new lines

I am saving users input to db as a string and I would like to remove all spaces at each lines. Input from user: Hi! My name is: Bob I am from the USA. I want to remove spaces between "Bob", so the result will be: Hi! My name is: Bob I am…
2
votes
1 answer

MVC 5 Entity Regular Expression for Arabic number is not working?

my regular expression is like, // [RegularExpression("^[0-9]*$", ErrorMessage = "must be numeric")] [RegularExpression("^[\u0660-\u0669]{10}$", ErrorMessage = "must be numeric")] public Nullable DecisionNumber { get; set; } I am…
2
votes
3 answers

Checking if a string contains any special characters in swift while allowing all languages

I saw a similar post to this but none of the answers there helped me. I am looking to check if a string does not contain any special characters using swift regular expressions. I want to allow other iPhone keyboard letters though like Chinese,…
Code_31
  • 57
  • 2
  • 6
2
votes
1 answer

Regex to get text between pair of square brackets in Swift

Lorem Ipsum.<\/strong> Lorem Ipsum. [link-to:shop-page \"instore-pickup\"]Learn More[\/link-to] Given a sample string above (it includes HTML) which I'm getting from 3-rd party service and it's out of my control to improve or normalize it to…
Evgeny Karkan
  • 8,782
  • 2
  • 32
  • 38
2
votes
1 answer

Find multiple quoted words in a string with regex

My app supports 5 languages. I have a string which has some double quotes in it. This string is translated into 5 languages in the localizable.strings files. Example: title_identifier = "Hi \"how\", are \"you\""; I would like to bold out "how" and…
nr5
  • 4,228
  • 8
  • 42
  • 82
2
votes
1 answer

Find Regular Expression

I have created a regular expression to find a certain pattern(example{ 008-150A-003E,9C1-E10-010 etc...) from a a paragraph but its failing by fetching me values based on length of the pattern. this is the Regx I…
2
votes
3 answers

Make patterns to use NSRegularExpression

Swift 4.4 I want to create NSAttributedString using NSRegularExpression ~This two~ are *bold text* and different and ~strikethrough~ and _italic (word*)_ ~abc~ Look like this, I can create and assign attributes but the problem is i…
Vatsal Shukla
  • 1,274
  • 12
  • 25
2
votes
1 answer

how to run multiples NSRegularExpression once

I have a bunch of NSRegularExpression and I want to run it once. Anyone knows how to do it ? For the moment I do it in a .forEach, for performance reasons I do not think this is the best idea Each NSRegularExpression needs to match a different…
2
votes
2 answers

Regular expression over the language C={a,b}

Good evening everyone,i'm getting stuck with the following regular expression, I think there is a much easier approach to the expression than mine, I had to writing down the regular expression and the dfa that from the alphabet {a,b} accepted all…
2
votes
1 answer

Validating model with regular expression

Hi I am using a validation like below to ensure I am just working on a csv file. [RegularExpression(@"(csv)|(CSV)")] public string AttachmentFileName { get; set; } After form submit model returns a value AttachmentFileName =…
viks
  • 23
  • 4
2
votes
3 answers

How to get hashtag from string that contains # at the beginning and end without space at the end?

This is my string "I made this wonderful pic last #chRistmas... #instagram #nofilter #snow #fun" and I would like to get hashtag that contains # at the beginning and end without space. My expected result is: $fun This is what I have so far for…
KevinVuD
  • 581
  • 2
  • 5
  • 25
2
votes
1 answer

Find structure in solidity file

I have the next structure in text file: mapping(address => uint) public lockedAddresses; and I want find it. I try use the next regular expression: mapping\s*\([\w\s=>\d]\)\s+(public\s+)?lockedAddresses. I don`t understand how can I find it. var…