Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
2 votes
2 answers
84 views

Append new line if '\n' appeared in API response

I am working on some front end task , where I am showing some APIs response on UI The thing is in my API response I am getting some messages which includes '\n'. So wherever '\n' is coming I want to ...
Jayesh Vyas's user avatar
  • 1,303
-1 votes
0 answers
21 views

SonarCloud security hotspot caused by regex [duplicate]

I have a regex to add thousand separators and I get a Denial of Service security hotspot in sonarcloud. I have this code function thousandSeparator(value: number | string | null | undefined) { return ...
user26094131's user avatar
0 votes
4 answers
75 views

Regular Expression to validate a CAGE Code

We need to write a RegEx which can validate a CAGE Code A CAGE Code is a five (5) position code. The format of the code is the first and fifth position must be numeric. The second, third and fourth ...
Angular animal's user avatar
0 votes
2 answers
78 views

How to match {0} but allowing proper escape?

I want to create a simple text templating that allow defining placeholders using {0}, similar to what .Net does using string.format method. Basically I want this: format("{0}", 42), // ...
Steve B's user avatar
  • 37.5k
-3 votes
1 answer
58 views

Regular Expression to remove repeated words or numbers [closed]

I want TypeScript code which uses Regular Expression to first understand repeated words or numbers in a string (like '2024' or 'May') and then replace the first matched ones with empty. Examples: // ...
Ali's user avatar
  • 1,420
-2 votes
1 answer
68 views

Regex returns eslint and ts errors [closed]

There is a text file which has key-value pairs as content. The value can optionaly be quoted. test="value" Now I need to get the value of a specific keyof, which I do with this regex: /test=...
user3142695's user avatar
  • 16.9k
1 vote
2 answers
95 views

Special Regular Expression match in javascript

I need JavaScript special regex pattern to convert the input string to required string. Input String: google.com/q=abc?param1=\[foo,bar\]&optional=true&param2=\[bar,baz\] Output String: ...
Beautiful Pine's user avatar
2 votes
4 answers
111 views

Regex to find match if a colon exists between double curly brackets {{key:value}}

I am trying to refactor the method below to use regex instead of indexOf: hasMatch(value: any): boolean { if (isDefined(value)) { const valueStr = JSON.stringify(value); return ...
js-newb's user avatar
  • 503
0 votes
1 answer
70 views

Using RegExp as parameter for a locator

I have this function that clicks on a locator and i want to use the locator as a parameter of type string or RegExp export async function clickRegexLocator(page: Page, locator:string|RegExp) { ...
GetTok's user avatar
  • 71
0 votes
0 answers
15 views

I need to restrict only | Pipe special character from input in angular [duplicate]

<dx-text-box (onKeyDown)="Submit($event)" (onValueChanged)="somthing()" maxLength="100"[(value)]="Description"> <dx-validator><dxi-validation-...
user24268988's user avatar
1 vote
1 answer
76 views

RegEx is not properly validated in production build, doesn't accept 0, 2, 7, a, c, u, x, sometimes also z

I'm using Angular 15.2.10 and Typescript in 4.9.5. I have the following RegEx provided in one of my libraries and exposed via a service: private readonly _DISALLOWED_CHARS_REGEX_GENERAL = new RegExp(...
TheRealOha's user avatar
0 votes
2 answers
154 views

How to write a regex to capture a number surrounded by other characters?

export interface ValueParserResult { value: number, error: string } interface subParseResult { result: (string | number) [], error: string } class ValueParser { parse(eq: string, values:...
GeeWhizBang's user avatar
-3 votes
1 answer
49 views

Regex for extracting monetary values

I have this regex /[0-9]*(\.[0-9]{3})*,([0-9]{2})?/g for extracting monetary values from text messages. It is working nicely when the value is in this format: R$ 1,00 However, if the text comes with:...
DValdir Martins's user avatar
-3 votes
3 answers
61 views

Need to use regex to get a string from a url

I have the following string https://test.io/content/storage/id/urn:aaid:sc:US:8eda16d4-baba-4c90-84ca-0f4c215358a1;revision=0?component_id=e62a5567-066d-452a-b147-19d909396132 I need to use regex to ...
Rue Vitale's user avatar
  • 1,767
2 votes
2 answers
614 views

Interact with locator that has dynamic value in playwright

I want to interact with the following locator <select name="ship[0][596211][address]" id="ship_0_596211_address" class="" title=""></select> using ...
GetTok's user avatar
  • 71

15 30 50 per page
1
2 3 4 5
38