# \\s causing $regexp error in format value

**URL:** <https://community.mp3tag.de/t/s-causing-regexp-error-in-format-value/19470>\
**Category:** Support\
**Created:** [October 24, 2017, 5:24pm UTC](https://community.mp3tag.de/t/s-causing-regexp-error-in-format-value/19470 "2017-10-24T17:24:52Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)\
**Post date:** [October 26, 2017, 1:52am UTC](https://community.mp3tag.de/t/s-causing-regexp-error-in-format-value/19470/6 "2017-10-26T01:52:05Z")

</div>

> [@Doug Mackie](#):
>
> A follow-up on using **\w** and **\s** in a character class: ...

See also ... [https://perldoc.perl.org/perlrecharclass.html](https://perldoc.perl.org/perlrecharclass.html)  
See also ... [https://regular-expressions.mobi/charclass.html](https://regular-expressions.mobi/charclass.html)

There is a list of backslash sequences, which are character classes.  
Probably these character classes also work within Mp3tag's "Boost" regexp implementation.

Simplified said ...  
\s ... matches any "whitespace character", ... the 5 characters [\t\n\f\r]

\w ... matches any "word character", ... the 63 characters [a-zA-Z0-9\_]  
... and perhaps other unicode characters as set by modifiers within the regexp machine.

If someone has the need to define and apply a character class for only the space character, ...  
then it is written as this:

Check this formatstring within Mp3tag:  
$len($regexp($char(9)$char(10)$char(11)$char(12)$char(13)$char(32)$char(133)$char(160),'\s',))  
==\> 0

My hint in a post above ...  
_"Have a look to the square brackets ... these are "characters with special functionality"_  
points to a special function within Mp3tag, which leads sometimes to confusion, when creating a regular expression:  
within Mp3tag scripting language the "square bracket clamb" is an inline function or an inline operator.

Therefore within a regular expression a square bracket clamp has to be enclosed (devalued) within single apostrophes (... or just simply the entire regular expression).

See also ...  
[Preventing empty output lines in export](https://community.mp3tag.de/t/17746/2)  
[Feature request:](https://community.mp3tag.de/t/16938/2)  
[RegEx to remove Square Brackets](https://community.mp3tag.de/t/16961/2)  
[https://docs.mp3tag.de/scripting](https://docs.mp3tag.de/scripting) (Characters with special functionality).

DD.20171026.0551.CEST

---

_[View the full topic](https://community.mp3tag.de/t/s-causing-regexp-error-in-format-value/19470)._
