Regular Expressions - What is difference between a+ and a⁺

I'm very confused as to if a+ and a⁺ mean the same thing or are completely different.

• It should be noted that, when you're dealing with practical implementations of regular expression syntax, the ^ symbol often means "the beginning of the string," and is therefore unavailable for notating superscripts. Nov 9 '21 at 18:01
• @Kevin Indeed: I’ve submitted an edit suggestion changing ^+ to here to avoid that. Nov 9 '21 at 18:37
• This is kind of like asking whether a || b and a or b are the same thing in the context of programming. The main difference is that different languages or authors use different ones (e.g. || in C++ and or in Python), and there may be small or big differences in how each language defines each of those things. Nov 10 '21 at 0:42
• @NotThatGuy Although not used commonly, you can also use or in C++ Nov 11 '21 at 8:50

Usually that is a matter of taste. If I am nathematically motivated then I write $$a^*$$ like some single argument postfix operations in mathematics. If I keep close to applications, I would type $$a*$$ because typing superscripts in input for programs seems silly.

Same for $$a^+$$.

Be aware that in the context of regular expressions plus $$+$$ might have another meaning. It might be the same as "choice" or "union". Thus people can write $$a+b$$, $$a\cup b$$, or $$a\mid b$$ depending on their choice for that binary operator.

• I would write $a^{+}b$ or a+b, but not $a+b$ or a⁺b. Nov 9 '21 at 21:05

a* means that "a" must occur zero or more times.
a+ means that "a" most occur one or more times.

In other words, a* allows an empty string, while a+ doesn't (unless a itself allows an empty string).

To write it: If your editor allows it easily, $$a^*$$ and $$a^+$$ are preferable, because they are correct. On this site: Dollar, a, caret, star, dollar for $$a^*$$. Exponent in curly braces like { 15 } if it is more than a single character, like $$a^{15}$$ and not $$a^15$$.

PS. Oh well. I read your question as a+ vs a*. Maybe $$a^+$$ is not such a good idea. Or I need new glasses :-(