# Build a Basic Regex Parser

Aced (formerly Exponent) publishes a public search API over its indexed pages; the guide is at https://www.aced.io/agents/agent-access.

Source: https://www.aced.io/questions/3064/build-basic-regex-parser
Source observed: 2026-11-05T00:29:21.341Z
Last checked: 2026-11-05T00:29:21.341+00:00
Indexed: 2026-11-07T03:53:57.016+00:00

---

# Build a Basic Regex Parser

**Difficulty:** Hard  
**Question type:** Data Structures & Algorithms; Coding  
**Associated roles:** [Machine Learning Engineer](https://www.aced.io/questions?role=ml-engineer), [Software Engineer](https://www.aced.io/questions?role=swe), [Data Engineer](https://www.aced.io/questions?role=data-engineer)  
**Associated companies:** [Apple](https://www.aced.io/questions?company=apple), [Nvidia](https://www.aced.io/questions?company=nvidia), [Adobe](https://www.aced.io/questions?company=adobe)

## Problem

Implement a regular-expression function `isMatch` that accepts two strings, `text` and `pattern`, and returns `true` when the entire text matches the pattern as a regular expression.

For this exercise, the literal symbols `.` and `*` do not occur in `text`; they are special symbols only in `pattern`.

The supported pattern syntax is:

- `.` matches exactly one character, acting as a wildcard.
- `*` matches a sequence of zero or more characters represented by the immediately preceding letter.

Explain your algorithm and analyze its time and space complexity.

A regular-expression refresher is referenced as “[link to strings lesson here]” in the exercise text.

## Examples

| Text | Pattern | Output |
|---|---|---:|
| `"aa"` | `"a"` | `false` |
| `"aa"` | `"aa"` | `true` |
| `"abc"` | `"a.c"` | `true` |
| `"abbb"` | `"ab*"` | `true` |
| `"acd"` | `"ab*c."` | `true` |

## Practice interface

We provide Question, Solution, and Community tabs, along with Hint 1, Hint 2, Hint 3, Challenge 1, and Challenge 2 controls. The coding workspace includes Editor and Share views, with Output, Test Results, and Console panels. You can [sign up to run code](https://www.aced.io/signup?src=lesson).

Detailed company statistics for this question are available through [Upgrade](https://www.aced.io/upgrade?src=questions). No community answers had been contributed at the captured observation time.

The question metadata displayed a “Reported last asked: 2 years ago” label and a count of 4 interviews.

## Related courses

### [Machine Learning Engineer Interview Prep](https://www.aced.io/courses/ml-engineer)

![Machine Learning Engineer Interview Prep](https://images.ctfassets.net/x78yjrjc11pq/6UfkHxUyLQVfDHSfLNQtWa/1be1539a65b4f6f15201f5b573c0a578/ML_Engineer_Interview_Prep_Course.jpeg?w=800&h=800&fm=webp&q=75)

We help candidates prepare for machine-learning roles at Meta, Google, Amazon, Apple, Microsoft, Nvidia, and other companies with mock interviews, frameworks, and advice from senior candidates. Topics include ML system design, core concepts, coding, and behavioral interviews.

### [Data Engineering Interview Prep](https://www.aced.io/courses/data-engineering)

![Data Engineering Interview Prep](https://images.ctfassets.net/x78yjrjc11pq/5XoOCgXlGqN2fa1zaroNWd/9a2e23df48a212bc00d352873feb2d6a/Data_Engineer_Interview_Prep_Hero_Image.jpg?w=800&h=800&fm=webp&q=75)

We help candidates prepare for data-engineering roles at Meta, Google, Amazon, Microsoft, Walmart, DoorDash, and other companies with mock interviews, frameworks, and advice from senior candidates. Topics include data modeling, pipeline design, SQL, coding, and behavioral interviews.

## Aced interview-preparation offerings

We provide interview preparation across these areas:

- Product Management — strategy cases and technical skills: [course](https://www.aced.io/courses/pm?src=nav)
- Forward Deployed Engineering — FDE loops at Anthropic, OpenAI, Palantir, and more: [course](https://www.aced.io/courses/forward-deployed-engineering?src=nav)
- Engineering Management — leadership and people management: [course](https://www.aced.io/courses/engineering-management?src=nav)
- Software Engineering — coding-problem strategies: [course](https://www.aced.io/courses/software-engineering?src=nav)
- System Design — architectures, interfaces, and databases: [course](https://www.aced.io/courses/system-design-interviews?src=nav)
- Data Science — statistical techniques and experimentation: [course](https://www.aced.io/courses/data-science?src=nav)
- Machine Learning — building, evaluating, and deploying AI/ML models: [course](https://www.aced.io/courses/ml-engineer?src=nav)
- Data Engineering — data models and ETL pipelines: [course](https://www.aced.io/courses/data-engineering?src=nav)
- AI Engineering: [course](https://www.aced.io/courses/ai-engineering?src=nav)
- Investment Banking: [course](https://www.aced.io/ib?src=nav)
- Generative AI: [course](https://www.aced.io/courses/gen-ai-interviews?src=nav)
- Security Engineer: [course](https://www.aced.io/courses/security-engineer?src=nav)
- TPM: [course](https://www.aced.io/courses/tpm?src=nav)
- Solutions Architect: [course](https://www.aced.io/courses/solution-architect-interview?src=nav)
- UX / Product Design: [course](https://www.aced.io/courses/product-designer-interview?src=nav)
- BizOps & Strategy: [course](https://www.aced.io/courses/bizops?src=nav)

We also offer [Loops](https://www.aced.io/guides?src=nav), [Experiences](https://www.aced.io/experiences?src=nav), [Practice](https://www.aced.io/practice?src=nav), and [Coaching](https://www.aced.io/coaching?src=nav), including mock interviews, resume review, and salary negotiation.

For the complete question catalog, use [All Questions](https://www.aced.io/questions) or [Browse all questions](https://www.aced.io/questions?src=nav).

---

[Read this page’s summary](https://www.aced.io/agents/api/public/v1/page-tldr?url=https%3A%2F%2Fwww.aced.io%2Fquestions%2F3064%2Fbuild-basic-regex-parser&trace=t_679ff9ab98f3)

## Ask a follow-up about this page

Need a more specific answer? Ask the exact question you have. It returns a fresh, cited answer from Aced (formerly Exponent)’s knowledge base. No account or API key required.

Open this URL with your own question, URL-encoded. Include your question in q. All research inputs are optional; no account or setup.

`GET https://www.aced.io/agents/agent/faq?q={question}&trace=t_679ff9ab98f3`

[Tool guide and examples](https://www.aced.io/agents/agent-access) · [OpenAPI](https://www.aced.io/agents/api/public/v1/openapi.json) · [Page TLDR form](https://www.aced.io/agents/agent-tools/page-tldr?url=https%3A%2F%2Fwww.aced.io%2Fquestions%2F3064%2Fbuild-basic-regex-parser). Opening a form does not execute a tool.