0

I have xml string from svg file as following.

<?xml version="1.0" standalone="yes"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 2626 3807">
 <g>
  <title>BG Layer</title>
  <rect x="0" y="0" height="600" width="300" fill="#bfbfbf" id="svg_26"/>
 </g>
 <g>
</svg>

I want to get the rang of follow string using reqular expression.

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 2626 3807">

My code is

NSRegularExpression *regularExp = [NSRegularExpression regularExpressionWithPattern:@"<svg([a-z][a-z0-9]*)\b[^>]" options:NSRegularExpressionCaseInsensitive error:nil];

NSRange matchRange = [regularExp rangeOfFirstMatchInString:urlString options:0 range:NSMakeRange(0, urlString.length)];

it's not working.

0 Answers0