{"id":18615050,"url":"https://github.com/andrewjbateman/angular-regex-project","last_synced_at":"2026-04-21T09:31:03.016Z","repository":{"id":33723495,"uuid":"161023311","full_name":"AndrewJBateman/angular-regex-project","owner":"AndrewJBateman","description":":clipboard: This app highlights search text within a string. It renders HTML on the screen via a variable and manipulates that HTML based on a query, a regular expression and regex replace logic.","archived":false,"fork":false,"pushed_at":"2023-03-04T03:01:22.000Z","size":3022,"stargazers_count":0,"open_issues_count":13,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-27T02:45:21.975Z","etag":null,"topics":["angular","angular13","css","highlight-text","html","html5","regex","regex-match","regular-expression","tutorial-code","typescript4"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AndrewJBateman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-09T09:19:46.000Z","updated_at":"2021-11-14T07:31:38.000Z","dependencies_parsed_at":"2023-02-15T07:16:02.422Z","dependency_job_id":null,"html_url":"https://github.com/AndrewJBateman/angular-regex-project","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fangular-regex-project","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fangular-regex-project/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fangular-regex-project/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fangular-regex-project/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AndrewJBateman","download_url":"https://codeload.github.com/AndrewJBateman/angular-regex-project/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239406450,"owners_count":19633024,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","angular13","css","highlight-text","html","html5","regex","regex-match","regular-expression","tutorial-code","typescript4"],"created_at":"2024-11-07T03:27:57.530Z","updated_at":"2025-11-03T03:30:33.345Z","avatar_url":"https://github.com/AndrewJBateman.png","language":"TypeScript","readme":"# :zap: Angular Regex Project\n\n* This app highlights search text within a string. It renders HTML on the screen via a variable and manipulates that HTML based on a query, a regular expression and REGEX replace logic.\n* **Note:** to open web links in a new window use: _ctrl+click on link_\n\n![GitHub repo size](https://img.shields.io/github/repo-size/AndrewJBateman/angular-regex-project?style=plastic)\n![GitHub pull requests](https://img.shields.io/github/issues-pr/AndrewJBateman/angular-regex-project?style=plastic)\n![GitHub Repo stars](https://img.shields.io/github/stars/AndrewJBateman/angular-regex-project?style=plastic)\n![GitHub last commit](https://img.shields.io/github/last-commit/AndrewJBateman/angular-regex-project?style=plastic)\n## :page_facing_up: Table of contents\n\n* [:zap: Angular Regex Project](#zap-angular-regex-project)\n  * [:page_facing_up: Table of contents](#page_facing_up-table-of-contents)\n  * [:books: General info](#books-general-info)\n  * [:camera: Screenshots](#camera-screenshots)\n  * [:signal_strength: Technologies](#signal_strength-technologies)\n  * [:floppy_disk: Setup](#floppy_disk-setup)\n  * [:computer: Code Examples](#computer-code-examples)\n  * [:cool: Features](#cool-features)\n  * [:clipboard: Status \u0026 To-Do List](#clipboard-status--to-do-list)\n  * [:clap: Inspiration](#clap-inspiration)\n  * [:envelope: Contact](#envelope-contact)\n\n## :books: General info\n\n* A regular expression is \"A sequence of characters that forms a search pattern, mainly for use in pattern-matching with strings, or string matching, i.e. “find and replace”-like operations.\"\n\n## :camera: Screenshots\n\n![Example screenshot](./img/highlight-text.png).\n\n## :signal_strength: Technologies\n\n* [Angular v13](https://angular.io/)\n* [Javascript Regular expressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions)\n\n## :floppy_disk: Setup\n\n* Run `ng test` to run some simple Jasmin testson Karma.\n* Run `ng lint` to check syntax using TSLint. Note [TSLint will be replaced with ESLint](https://github.com/palantir/tslint/issues/4534)\n* Run `ng serve` for a dev server.\n* Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.\n\n## :computer: Code Examples\n\n* extract from `app.component.ts file`\n\n```typescript\n\nexport class AppComponent {\n\n  private content: string;\n  public query: string;\n\n  public constructor() {\n  // tslint:disable-next-line: max-line-length\n    this.content = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent a quam ornare bibendum; ligula; a, rhoncus; ligula. Etiam; aliquet, justo; sollicitudin; imperdiet; luctus, nulla justo; sodales; mi, sit; amet; semper; nisl; velit; vel; massa. In; hac; habitasse; platea; dictumst';\n  }\n\n  // if no text in query then just return\n  public highlight(): string {\n    if (!this.query) {\n      return this.content;\n    }\n    /*The regular expression looks for all case insensitive occurrences of this.query.\n    Take the matches and wrap them in HTML tags with the CSS class name that we created.*/\n    return this.content.replace(new RegExp(this.query, 'gi'), match =\u003e {\n      return '\u003cspan class=\"highlightText\"\u003e' + match + '\u003c/span\u003e';\n    });\n  }\n}\n```\n\n## :cool: Features\n\n* text that matches what is being searched for is highlighted. The query is case-insensitive.\n\n## :clipboard: Status \u0026 To-Do List\n\n* Status: Working. Passes basic Jasmine tests\n* To-Do: This could be used as a sand-box to try out other angular functionality. Regex could be expanded to search for numbers and highlight them in a different colour etc.\n\n## :clap: Inspiration\n\n* [\"Highlight Text Within a String Using Angular and Regular Expressions\", by Nic Raboy of X-Team.com](https://developer.telerik.com/topics/web-development/highlight-text-within-string-using-angular-regular-expressions/).\n\n## :file_folder: License\n\n* N/A\n\n## :envelope: Contact\n\n* Repo created by [ABateman](https://github.com/AndrewJBateman), email: gomezbateman@yahoo.com\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewjbateman%2Fangular-regex-project","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewjbateman%2Fangular-regex-project","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewjbateman%2Fangular-regex-project/lists"}