Skip to content

Commit fae221e

Browse files
committed
update header doc to swift 2.0 format
1 parent ee8651f commit fae221e

File tree

1 file changed

+78
-78
lines changed

1 file changed

+78
-78
lines changed

PySwiftyRegex/PySwiftyRegex.swift

Lines changed: 78 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ public class re {
3131

3232
See https://docs.python.org/2/library/re.html#re.compile
3333

34-
:param: pattern regular expression pattern string
35-
:param: flags NSRegularExpressionOptions value
34+
- parameter pattern: regular expression pattern string
35+
- parameter flags: NSRegularExpressionOptions value
3636

37-
:returns: The created RegexObject object. If the pattern is invalid, RegexObject.isValid is false, and all methods have a default return value.
37+
- returns: The created RegexObject object. If the pattern is invalid, RegexObject.isValid is false, and all methods have a default return value.
3838
*/
3939
public static func compile(pattern: String, flags: RegexObject.Flag = []) -> RegexObject {
4040
return RegexObject(pattern: pattern, flags: flags)
@@ -45,11 +45,11 @@ public class re {
4545

4646
See https://docs.python.org/2/library/re.html#re.search
4747

48-
:param: pattern regular expression pattern string
49-
:param: string string to be searched
50-
:param: flags NSRegularExpressionOptions value
48+
- parameter pattern: regular expression pattern string
49+
- parameter string: string to be searched
50+
- parameter flags: NSRegularExpressionOptions value
5151

52-
:returns: Corresponding MatchObject instance. Return nil if no position in the string matches the pattern or pattern is invalid; note that this is different from finding a zero-length match at some point in the string.
52+
- returns: Corresponding MatchObject instance. Return nil if no position in the string matches the pattern or pattern is invalid; note that this is different from finding a zero-length match at some point in the string.
5353
*/
5454
public static func search(pattern: String, _ string: String, flags: RegexObject.Flag = []) -> MatchObject? {
5555
return re.compile(pattern, flags: flags).search(string)
@@ -60,11 +60,11 @@ public class re {
6060

6161
See https://docs.python.org/2/library/re.html#re.match
6262

63-
:param: pattern regular expression pattern string
64-
:param: string string to be searched
65-
:param: flags NSRegularExpressionOptions value
63+
- parameter pattern: regular expression pattern string
64+
- parameter string: string to be searched
65+
- parameter flags: NSRegularExpressionOptions value
6666

67-
:returns: Corresponding MatchObject instance. Return nil if the string does not match the pattern or pattern is invalid; note that this is different from a zero-length match.
67+
- returns: Corresponding MatchObject instance. Return nil if the string does not match the pattern or pattern is invalid; note that this is different from a zero-length match.
6868
*/
6969
public static func match(pattern: String, _ string: String, flags: RegexObject.Flag = []) -> MatchObject? {
7070
return re.compile(pattern, flags: flags).match(string)
@@ -75,12 +75,12 @@ public class re {
7575

7676
See https://docs.python.org/2/library/re.html#re.split
7777

78-
:param: pattern regular expression pattern string
79-
:param: string string to be splitted
80-
:param: maxsplit maximum number of times to split the string, defaults to 0, meaning no limit is applied
81-
:param: flags NSRegularExpressionOptions value
78+
- parameter pattern: regular expression pattern string
79+
- parameter string: string to be splitted
80+
- parameter maxsplit: maximum number of times to split the string, defaults to 0, meaning no limit is applied
81+
- parameter flags: NSRegularExpressionOptions value
8282

83-
:returns: Array of splitted strings
83+
- returns: Array of splitted strings
8484
*/
8585
public static func split(pattern: String, _ string: String, _ maxsplit: Int = 0, flags: RegexObject.Flag = []) -> [String?] {
8686
return re.compile(pattern, flags: flags).split(string, maxsplit)
@@ -91,11 +91,11 @@ public class re {
9191

9292
See https://docs.python.org/2/library/re.html#re.findall
9393

94-
:param: pattern regular expression pattern string
95-
:param: string string to be searched
96-
:param: flags NSRegularExpressionOptions value
94+
- parameter pattern: regular expression pattern string
95+
- parameter string: string to be searched
96+
- parameter flags: NSRegularExpressionOptions value
9797

98-
:returns: Array of matched substrings
98+
- returns: Array of matched substrings
9999
*/
100100
public static func findall(pattern: String, _ string: String, flags: RegexObject.Flag = []) -> [String] {
101101
return re.compile(pattern, flags: flags).findall(string)
@@ -106,11 +106,11 @@ public class re {
106106

107107
See https://docs.python.org/2/library/re.html#re.finditer
108108

109-
:param: pattern regular expression pattern string
110-
:param: string string to be searched
111-
:param: flags NSRegularExpressionOptions value
109+
- parameter pattern: regular expression pattern string
110+
- parameter string: string to be searched
111+
- parameter flags: NSRegularExpressionOptions value
112112

113-
:returns: Array of match results as MatchObject instances
113+
- returns: Array of match results as MatchObject instances
114114
*/
115115
public static func finditer(pattern: String, _ string: String, flags: RegexObject.Flag = []) -> [MatchObject] {
116116
return re.compile(pattern, flags: flags).finditer(string)
@@ -121,13 +121,13 @@ public class re {
121121

122122
See https://docs.python.org/2/library/re.html#re.sub
123123

124-
:param: pattern regular expression pattern string
125-
:param: repl replacement string
126-
:param: string string to be searched and replaced
127-
:param: count maximum number of times to perform replace operations to the string
128-
:param: flags NSRegularExpressionOptions value
124+
- parameter pattern: regular expression pattern string
125+
- parameter repl: replacement string
126+
- parameter string: string to be searched and replaced
127+
- parameter count: maximum number of times to perform replace operations to the string
128+
- parameter flags: NSRegularExpressionOptions value
129129

130-
:returns: replaced string
130+
- returns: replaced string
131131
*/
132132
public static func sub(pattern: String, _ repl: String, _ string: String, _ count: Int = 0, flags: RegexObject.Flag = []) -> String {
133133
return re.compile(pattern, flags: flags).sub(repl, string, count)
@@ -138,13 +138,13 @@ public class re {
138138

139139
See https://docs.python.org/2/library/re.html#re.subn
140140

141-
:param: pattern regular expression pattern string
142-
:param: repl replacement string
143-
:param: string string to be searched and replaced
144-
:param: count maximum number of times to perform replace operations to the string
145-
:param: flags NSRegularExpressionOptions value
141+
- parameter pattern: regular expression pattern string
142+
- parameter repl: replacement string
143+
- parameter string: string to be searched and replaced
144+
- parameter count: maximum number of times to perform replace operations to the string
145+
- parameter flags: NSRegularExpressionOptions value
146146

147-
:returns: a tuple (new_string, number_of_subs_made) as (String, Int)
147+
- returns: a tuple (new_string, number_of_subs_made) as (String, Int)
148148
*/
149149
public static func subn(pattern: String, _ repl: String, _ string: String, _ count: Int = 0, flags: RegexObject.Flag = []) -> (String, Int) {
150150
return re.compile(pattern, flags: flags).subn(repl, string, count)
@@ -186,10 +186,10 @@ public class re {
186186
/**
187187
Create A re.RegexObject Instance
188188

189-
:param: pattern regular expression pattern string
190-
:param: flags NSRegularExpressionOptions value
189+
- parameter pattern: regular expression pattern string
190+
- parameter flags: NSRegularExpressionOptions value
191191

192-
:returns: The created RegexObject object. If the pattern is invalid, RegexObject.isValid is false, and all methods have a default return value.
192+
- returns: The created RegexObject object. If the pattern is invalid, RegexObject.isValid is false, and all methods have a default return value.
193193
*/
194194
public required init(pattern: String, flags: Flag = []) {
195195
self.pattern = pattern
@@ -206,12 +206,12 @@ public class re {
206206

207207
See https://docs.python.org/2/library/re.html#re.RegexObject.search
208208

209-
:param: string string to be searched
210-
:param: pos position in string where the search is to start, defaults to 0
211-
:param: endpos position in string where the search it to end (non-inclusive), defaults to nil, meaning the end of the string. If endpos is less than pos, no match will be found.
212-
:param: options NSMatchOptions value
209+
- parameter string: string to be searched
210+
- parameter pos: position in string where the search is to start, defaults to 0
211+
- parameter endpos: position in string where the search it to end (non-inclusive), defaults to nil, meaning the end of the string. If endpos is less than pos, no match will be found.
212+
- parameter options: NSMatchOptions value
213213

214-
:returns: search result as MatchObject instance if a match is found, otherwise return nil
214+
- returns: search result as MatchObject instance if a match is found, otherwise return nil
215215
*/
216216
public func search(string: String, _ pos: Int = 0, _ endpos: Int? = nil, options: NSMatchingOptions = []) -> MatchObject? {
217217
guard let regex = regex else {
@@ -233,11 +233,11 @@ public class re {
233233

234234
See https://docs.python.org/2/library/re.html#re.RegexObject.match
235235

236-
:param: string string to be matched
237-
:param: pos position in string where the search is to start, defaults to 0
238-
:param: endpos position in string where the search it to end (non-inclusive), defaults to nil, meaning the end of the string. If endpos is less than pos, no match will be found.
236+
- parameter string: string to be matched
237+
- parameter pos: position in string where the search is to start, defaults to 0
238+
- parameter endpos: position in string where the search it to end (non-inclusive), defaults to nil, meaning the end of the string. If endpos is less than pos, no match will be found.
239239

240-
:returns: match result as MatchObject instance if a match is found, otherwise return nil
240+
- returns: match result as MatchObject instance if a match is found, otherwise return nil
241241
*/
242242
public func match(string: String, _ pos: Int = 0, _ endpos: Int? = nil) -> MatchObject? {
243243
return search(string, pos, endpos, options: [.Anchored])
@@ -248,10 +248,10 @@ public class re {
248248

249249
See https://docs.python.org/2/library/re.html#re.RegexObject.split
250250

251-
:param: string string to be splitted
252-
:param: maxsplit maximum number of times to split the string, defaults to 0, meaning no limit is applied
251+
- parameter string: string to be splitted
252+
- parameter maxsplit: maximum number of times to split the string, defaults to 0, meaning no limit is applied
253253

254-
:returns: Array of splitted strings
254+
- returns: Array of splitted strings
255255
*/
256256
public func split(string: String, _ maxsplit: Int = 0) -> [String?] {
257257
guard let regex = regex else {
@@ -291,11 +291,11 @@ public class re {
291291

292292
See https://docs.python.org/2/library/re.html#re.RegexObject.findall
293293

294-
:param: string string to be matched
295-
:param: pos position in string where the search is to start, defaults to 0
296-
:param: endpos position in string where the search it to end (non-inclusive), defaults to nil, meaning the end of the string. If endpos is less than pos, no match will be found.
294+
- parameter string: string to be matched
295+
- parameter pos: position in string where the search is to start, defaults to 0
296+
- parameter endpos: position in string where the search it to end (non-inclusive), defaults to nil, meaning the end of the string. If endpos is less than pos, no match will be found.
297297

298-
:returns: Array of matched substrings
298+
- returns: Array of matched substrings
299299
*/
300300
public func findall(string: String, _ pos: Int = 0, _ endpos: Int? = nil) -> [String] {
301301
return finditer(string, pos, endpos).map { $0.group()! }
@@ -306,11 +306,11 @@ public class re {
306306

307307
https://docs.python.org/2/library/re.html#re.RegexObject.finditer
308308

309-
:param: string string to be matched
310-
:param: pos position in string where the search is to start, defaults to 0
311-
:param: endpos position in string where the search it to end (non-inclusive), defaults to nil, meaning the end of the string. If endpos is less than pos, no match will be found.
309+
- parameter string: string to be matched
310+
- parameter pos: position in string where the search is to start, defaults to 0
311+
- parameter endpos: position in string where the search it to end (non-inclusive), defaults to nil, meaning the end of the string. If endpos is less than pos, no match will be found.
312312

313-
:returns: Array of match results as MatchObject instances
313+
- returns: Array of match results as MatchObject instances
314314
*/
315315
public func finditer(string: String, _ pos: Int = 0, _ endpos: Int? = nil) -> [MatchObject] {
316316
guard let regex = regex else {
@@ -328,11 +328,11 @@ public class re {
328328

329329
See https://docs.python.org/2/library/re.html#re.RegexObject.sub
330330

331-
:param: repl replacement string
332-
:param: string string to be searched and replaced
333-
:param: count maximum number of times to perform replace operations to the string
331+
- parameter repl: replacement string
332+
- parameter string: string to be searched and replaced
333+
- parameter count: maximum number of times to perform replace operations to the string
334334

335-
:returns: replaced string
335+
- returns: replaced string
336336
*/
337337
public func sub(repl: String, _ string: String, _ count: Int = 0) -> String {
338338
return subn(repl, string, count).0
@@ -343,11 +343,11 @@ public class re {
343343

344344
See https://docs.python.org/2/library/re.html#re.RegexObject.subn
345345

346-
:param: repl replacement string
347-
:param: string string to be searched and replaced
348-
:param: count maximum number of times to perform replace operations to the string
346+
- parameter repl: replacement string
347+
- parameter string: string to be searched and replaced
348+
- parameter count: maximum number of times to perform replace operations to the string
349349

350-
:returns: a tuple (new_string, number_of_subs_made) as (String, Int)
350+
- returns: a tuple (new_string, number_of_subs_made) as (String, Int)
351351
*/
352352
public func subn(repl: String, _ string: String, _ count: Int = 0) -> (String, Int) {
353353
guard let regex = regex else {
@@ -398,9 +398,9 @@ public class re {
398398

399399
See https://docs.python.org/2/library/re.html#re.MatchObject.expand
400400

401-
:param: template regular expression template decribing the expanded format
401+
- parameter template: regular expression template decribing the expanded format
402402

403-
:returns: expanded string
403+
- returns: expanded string
404404
*/
405405
public func expand(template: String) -> String {
406406
guard let regex = match.regularExpression else {
@@ -416,9 +416,9 @@ public class re {
416416

417417
See https://docs.python.org/2/library/re.html#re.MatchObject.group
418418

419-
:param: index group index, defaults to 0, meaning the entire matching string
419+
- parameter index: group index, defaults to 0, meaning the entire matching string
420420

421-
:returns: string of the matching group
421+
- returns: string of the matching group
422422
*/
423423
public func group(index: Int = 0) -> String? {
424424
guard let range = span(index) where range.startIndex < string.endIndex else {
@@ -432,9 +432,9 @@ public class re {
432432

433433
See https://docs.python.org/2/library/re.html#re.MatchObject.group
434434

435-
:param: indexes array of group indexes to get
435+
- parameter indexes: array of group indexes to get
436436

437-
:returns: array of strings of the matching groups
437+
- returns: array of strings of the matching groups
438438
*/
439439
public func group(indexes: [Int]) -> [String?] {
440440
return indexes.map { group($0) }
@@ -447,9 +447,9 @@ public class re {
447447

448448
See https://docs.python.org/2/library/re.html#re.MatchObject.groups
449449

450-
:param: defaultValue default value string
450+
- parameter defaultValue: default value string
451451

452-
:returns: array of all matching subgroups as String
452+
- returns: array of all matching subgroups as String
453453
*/
454454
public func groups(defaultValue: String) -> [String] {
455455
return (1..<match.numberOfRanges).map { group($0) ?? defaultValue }
@@ -462,7 +462,7 @@ public class re {
462462

463463
See https://docs.python.org/2/library/re.html#re.MatchObject.groups
464464

465-
:returns: array of all matching subgroups as String? (nil when relevant optional capture group is not matched)
465+
- returns: array of all matching subgroups as String? (nil when relevant optional capture group is not matched)
466466
*/
467467
public func groups() -> [String?] {
468468
return (1..<match.numberOfRanges).map { group($0) }
@@ -473,9 +473,9 @@ public class re {
473473

474474
See https://docs.python.org/2/library/re.html#re.MatchObject.span
475475

476-
:param: index group index
476+
- parameter index: group index
477477

478-
:returns: range of matching group substring
478+
- returns: range of matching group substring
479479
*/
480480
public func span(index: Int = 0) -> Range<String.Index>? {
481481
if index >= match.numberOfRanges {

0 commit comments

Comments
 (0)