Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Parsing error: Expecting Unicode escape sequence \uXXXX

March 06 (3 years ago)
Ernest P.
Pro
API Scripter

Getting the above error, but not exactly sure how to fix it. According to Regex101, the regular expression should be valid and matches what I want. Code:

  const parseAttrMatches = (val) => {
	var reg = \d{1,3}\s+[a-z ]+/ig;
    var result;
    while((result = reg.exec(val)) !== null) {
      logDebug(result)
    }
    return 
  }

Ideas?

- E

March 06 (3 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator

Your regex definition is incorrect. Regex is put between /'s. You're missing the starting slash.

March 06 (3 years ago)
Andrew R.
Pro
Sheet Author

Insert Unix grognard joke about vi here. ;) 

I confess to thinking "where's your leading slash?" because of my vi experience, not any JavaScript clue.

March 07 (3 years ago)
Ernest P.
Pro
API Scripter


Scott C. said:

Your regex definition is incorrect. Regex is put between /'s. You're missing the starting slash.

Thanks! Too many regex variations in the languages I use. I just could not see it.


- E