‘/(?:i am|i\’m)\s+(not\s+)?allowed\s+to\s+(.+)$/i’,

‘/(?:i am|i\’m)\s+(not\s+)?(supposed\s+to|able\s+to)\s+(.+)$/i’,

‘/(dad|mom|parent|[a-z]+)\s+(says|said)?\s+(?:i\’m|i am|i|you are)\s+(not\s+|can\’t|cannot|allowed to)\s+(.+)$/i’,

‘/(dad|mom|parent|[a-z]+)\s+(says|said)?\s+(?:i\’m|i am|i|you are)\s+(can|allowed to)\s+(.+)$/i’,

‘/(?:i\s+)?(can\’t|cannot)\s+(.+)$/i’

Makes total sense, right? Well, even I have a hard time with regex and I’ve been doing this for years. It definitely won’t be able to understand everything, especially if the youth can’t spell or uses short-form slang. Good luck trying to figure out finna and rizz in the above. What it CAN do, however, is parse basic sentences without needing to fall back to AI to figure it out. This is part of the brAIn project, Building an AI Memory Assistant for Neurodivergent Youth.

These regular expressions are designed to match various ways a youth might express permission, ability, or restriction. They are focused on first-person statements (I), third-person statements about the user (you), and statements involving an authority figure (like dad or mom).

Here are examples of sentences that would be matched by each of the five regex patterns:

1. /^(?:i am|i'm)\s+(not\s+)?allowed\s+to\s+(.+)$/i

This pattern matches “I am/I’m” followed by “(not) allowed to” and an action.

  • “I’m allowed to stay out late.”
  • “I am allowed to watch the movie.”
  • “I am not allowed to use my phone.”
  • “I’m not allowed to go to the party.”

2. /^(?:i am|i'm)\s+(not\s+)?(supposed\s+to|able\s+to)\s+(.+)$/i

This pattern matches “I am/I’m” followed by “(not) supposed to” or “(not) able to” and an action.

  • “I’m supposed to finish my homework first.”
  • “I am not supposed to eat any more candy.”
  • “I’m able to lift that box.”
  • “I am not able to come to the meeting.”

3. /(dad|mom|parent|[a-z]+)\s+(says|said)?\s+(?:i'm|i am|i|you are)\s+(not\s+|can't|cannot|allowed to)\s+(.+)$/i

This pattern is more complex, matching an authority figure (e.g., dad, mom, teacher) who states a restriction on “I/I’m” or “you are.”

  • Mom says I can’t go outside.”
  • Dad said I am not allowed to play video games.”
  • The teacher says I am not doing it correctly.”
  • My sister said you are not allowed to touch her stuff.”
  • Parent says I cannot have any ice cream.”

4. /(dad|mom|parent|[a-z]+)\s+(says|said)?\s+(?:i'm|i am|i|you are)\s+(can|allowed to)\s+(.+)$/i

This pattern is similar to the third one but matches an authority figure who grants permission/ability using “can” or “allowed to.”

  • Dad says I can drive the car.”
  • Mom said I am allowed to stay up late.”
  • The boss says I can take an extra day off.”
  • Parent said you are allowed to invite one friend.”

5. /(?:i\s+)?(can't|cannot)\s+(.+)$/i

This pattern matches simple first-person statements of inability or restriction using “can’t” or “cannot.” 

  • I can’t go to see this movie.”
  • I cannot drink alcohol.”
  • Can’t hang out with my friends tonight.” (Matches even without “I”)
  • Cannot remember what I was doing.” (Matches even without “I”)