# String.match(regexp) JSDoc Oddity

**URL:** <https://forum.servoy.com/t/string-match-regexp-jsdoc-oddity/19276>\
**Category:** Classic Servoy\
**Created:** [May 31, 2017, 12:22am UTC](https://forum.servoy.com/t/string-match-regexp-jsdoc-oddity/19276 "2017-05-31T00:22:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kwpsd](https://avatars.discourse-cdn.com/v4/letter/k/bb73d2/32.png) [@kwpsd](https://forum.servoy.com/u/kwpsd)\
**Post date:** [May 31, 2017, 12:22am UTC](https://forum.servoy.com/t/string-match-regexp-jsdoc-oddity/19276/1 "2017-05-31T00:22:35Z")

</div>

string.match(regexp) returns an array of strings. So the proper JSDoc nomenclature should be @return{String}, but Servoy creates a warning marker:

[attachment=1]servoy\_regex\_match\_1.png[/attachment]

Changing the JSDoc nomenclature to @return{String} makes the warning maker go away but is not correct.

[attachment=0]servoy\_regex\_match\_2.png[/attachment]

Am I missing something?

---

<div class="post-metadata">

**Author:** ![vschuurhof](https://avatars.discourse-cdn.com/v4/letter/v/46a35a/32.png) [@vschuurhof](https://forum.servoy.com/u/vschuurhof)\
**Post date:** [June 22, 2017, 10:26am UTC](https://forum.servoy.com/t/string-match-regexp-jsdoc-oddity/19276/2 "2017-06-22T10:26:39Z")

</div>

It seems you are close. But the JSDoc notation in Servoy should not be

```auto
@return {String[]}

```

but

```auto
@return {Array<String>}

```

---

<div class="post-metadata">

**Author:** ![kwpsd](https://avatars.discourse-cdn.com/v4/letter/k/bb73d2/32.png) [@kwpsd](https://forum.servoy.com/u/kwpsd)\
**Post date:** [June 22, 2017, 4:58pm UTC](https://forum.servoy.com/t/string-match-regexp-jsdoc-oddity/19276/3 "2017-06-22T16:58:41Z")

</div>

Well, that’s interesting, because I use {String} in JSDoc notation everywhere with no warning or error markers (except for the String.match(regex) expression). For example:

[attachment=0]servoy\_regex\_match\_3.png[/attachment]

Why does JSDoc accept {String} notation in some cases but not in others? If {String} is improper notation, why is it not flagged everywhere as a warning or error? Why does String.match(regex) appear to be a special case for JSDoc? I do not mind changing to the other notation, but I would like to know the reason for it.

---

<div class="post-metadata">

**Author:** ![pbakker](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@pbakker](https://forum.servoy.com/u/pbakker)\
**Post date:** [June 23, 2017, 6:19am UTC](https://forum.servoy.com/t/string-match-regexp-jsdoc-oddity/19276/4 "2017-06-23T06:19:47Z")

</div>

String, string, Array and Array are all synonyms, so doesn’t matter which one you use
