I want to match an occurrence of 1 that comes after either the beginning of the String or a.
I've tried [\Aa]1, but this gives me a PatternSyntaxException.
Try a pattern like this:
(^|a)1
The ^ will match the begining of the string, while the a will match a literal Latin letter a. The | is called an alternation, and will match either the pattern on the left or the right, while parentheses restrict the scope of the alternation.
Now, this will include the a as part of the matched string. If you'd like to avoid this you can either use a lookbehind, like this:
(?<=^|a)1
This will match a 1, but only if it is immediately preceeded by the beginning of the string or a Latin letter a.
^ just because it's easier for me to remember. I had assumed [\Aa] was an attempt to match a case insensitively. The reason why \A doesn't work inside a character class is that it's not actually a character, but a kind of zero-width assertion.