garysieling / garysieling/jquery-highlighttextarea

Invalid regular expression: Nothing to repeat

Open
#84 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
157
Forks
72
PR merge metrics
No merged PRs in 30d

Description

I'm trying to highlight some textareas in order to color in red all texts inside curly brackets:

```javascript
$('textarea').highlightTextarea({
'words': [{
'color': 'lightsalmon',
'words': ['{(.+?)}']
}]
});
```

It's working fine for most examples, except when the component tries to highlight curly bracked with only numbers inside:

```
{1104}{695}{592}{290}{278}{284}{291}
```

On highlighting, component returns the following error and aborts: "Uncaught SyntaxError: Invalid regular expression: /{1104}/: Nothing to repeat".

I also tried changing the regex to ['{[A-z0-9: ]*}'], but the problem persists.

I'm using version 3.1.3, and jQuery 1.11.0.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.