diff --git a/expr.c b/expr.c
index 40d1c30069f87810505fa7148adeee5983093fe1..f1a00c63d8dc39fcce224050a57c6b80692da5a6 100644
--- a/expr.c
+++ b/expr.c
@@ -29,7 +29,7 @@ static int parseValue(const char **pp, long *v)
     o = *p;
     if (memchr("+-~!", o, 4))
     {
-        /* handle unary operators */
+        /* unary operators */
         p++;
         if (!parseValue(&p, &val)) return 0; /* no valid value */
         if (exprDebug) printf("parseValue: %c %ld\n", o, val);
@@ -39,15 +39,24 @@ static int parseValue(const char **pp, long *v)
     }
     else if (o == '(')
     {
-        /* handle sub-expression */
+        /* sub-expression */
         p++;
         if (parseExpr(&p, &val) < 0) return 0; /* no valid expression */
         skipSpace(p);
         if (*p++ != ')') return 0; /* missing ) */
     }
+    else if (o == '#')
+    {
+        /* string length operator */
+        p++;
+        if (exprDebug) printf("parseValue: string length of %s\n", p);
+        if (*p == '"' || *p == '\'')
+            val = parseString(&p, NULL);
+        else return 0;
+    }
     else
     {
-        /* get number */
+        /* number */
         char *e;
         val = strtol(p, &e, 0);
         if (e == p) return 0; /* no number */
diff --git a/teststrings b/teststrings
index 7366646b4aa1848a6c133dd0688e86cd6351b826..9d6b4085aca83a65adce574dee68df8107ad2893 100644
--- a/teststrings
+++ b/teststrings
@@ -78,3 +78,14 @@ x="Hello World"[7,-1]
 
 x='\"\\x'[2]
 # $(x) should be: x
+
+x=#"Hello World"
+# $(x) should be: 11
+
+x=#"Hello World"[2:8]
+# $(x) should be: 6
+
+x=#Hello World
+# $(x) should be: #Hello World
+
+