Issue I am trying to create a validator for only integers (e.g., 60) using Regex. Here how I am trying to do it: meter: [“”, Validators.required, Validators.pattern(/[0-9]/)] It does not work, but I have to say I am not familiar
Continue readingTag: regex
Number keyboard without pattern in angular
Issue I’m using NgX-Mask to mask my input box. I want to include special characters in the mask so i have used [dropSpecialCharacters]=”false” from the NgXMask. Because of angular validation it showing red indicator as pattern is not matched. Pattern
Continue readingRegEx to match stuff between parentheses
Issue I’m having a tough time getting this to work. I have a string like: something/([0-9])/([a-z]) And I need regex or a method of getting each match between the parentheses and return an array of matches like: [ [0-9], [a-z]
Continue readingCheck if a string matches a regex in Bash script
Issue One of the arguments that my script receives is a date in the following format: yyyymmdd. I want to check if I get a valid date as an input. How can I do this? I am trying to use
Continue readingHow to search JSON data in mysql using Regular expression
Issue I am new to regular expression, I have stored JSON data in table. I want to fetch data based on userId, userId is a property of Users Object. Example: I want fetch all the records if users contain 513
Continue readingCan I introspect a Regex's interpolated value?
Issue In the code below, the Regex $r clearly "knows" that it contains the text bar – that’s how it is able to match against the Str bar. But .gist and .raku report that $r contains the variable $foo without
Continue readingJava Regex: Replace all ${placeholders} with map values
Issue I’m trying to replace all occurrences of ${placeholders} with values from a lookup map of placeholder -> value The code below doesn’t quite cut it. Expected :[foobar, foobar, foobar, afoobbarc] Actual :[foobar, foobar, ${key1}bar, a${key1}bbarc] Can anyone think of
Continue readingVim: why is this highlight definition neutralizing the other?
Issue I built the following highlight definitions (thanks to an answer in this question): ” #a6e22e syntax match tagFunctionDefinition “\v\<” syntax match tagFunctionDefinition “\v\>” syntax match tagFunctionDefinition “\v/” hi def link tagFunctionDefinition Function ” #f6266e syntax match tagOperator “\v\<\/?\zs\w+\ze\/?>” hi
Continue readingTkinter clearing formatting from syntax highlighting
Issue I have syntax highlighting implemented in Python using Tkinter. For example, I can make it automatically highlight “derp”. The problem is that when I modify the string to, say, “dERP”or something similar, it will still highlight the “d” (aka
Continue readingQSyntaxHighlighter multiline comment in document not appearing correctly
Issue Referring to Syntax Highlighter Example provided by QT official website, I tried to implement (actually you can call copy paste) the same logic for multiline comment in my application. For reference this is the code for multiline comment highlighting:
Continue readingFinding Magic Numbers With Regex
Issue I’m working with a syntax highlighting control and I have to specify all of the highlighted stuff with Regex. I’ve completed everything else (keywords, functions, strings, comments, etc.) already but I can’t come up with a good rule for
Continue readingSyntax Highlighting in VIM to match first/last letter of line
Issue I’m trying to to setup syntax highlighting in VIM to match the whole line only if the first non-whitespace character is "-" or if the last non-whitespace character of the line is ":". A typical line has many tabs
Continue readingGet the first word in a pattern (using oniguruma on SublimeText)
Issue When trying to define a new language that extends HTML on SublimeText, i can’t seem to find the right syntax for getting the first word on a pattern. my goal is when this will appear: [[something\something else else else]]
Continue readingRegex: match multiple times within regex defined region (emacs)
Issue I’m working on syntax highlighting for a markdown + latex combination I use. The major-mode of the document is markdown, and the bit I’m stuck on is highlighting latex’s special characters inside the latex blocks. If we take the
Continue readingJS code highlighting regex
Issue I’m a beginner in regex. I’ve been trying on regex101 trying to figure out a way to capture the variable identifiers in declarations. Basically the x in var x = 1; but not x = x + 1. I’m
Continue readingUse alternate syntax highlighting in middle of TextMate2 comment
Issue By the very nature of a comment, this might not make sense. On the other hand, what I’m trying to achieve is not too different from an escape character. As a simple example, I want # comment :break: comment
Continue readingMeaning of question mark and x in a regex group
Issue I’m trying to learn Atom’s syntax highlighting/grammar rules, which heavily use JS regular expressions, and came across an unfamiliar pattern in the python grammar file. The pattern starts with a (?x) which is an unfamiliar regex to me. I
Continue readingMatching entire string in gtksourceview
Issue Take this short XML snippet for defining strings in gtksourceview: <context id=”string” style-ref=”string” end-at-line-end=”true”> <start>”</start> <end>”</end> <include> <context id=”special-string” style-ref=”special”> <match>(foo|bar)</match> </context> <context ref=”def:line-continue”/> </include> </context> This highlights any instances of “foo” or “bar” inside a string. Suppose I
Continue readingRegex match everything between dot '.' and close brace '('
Issue I have myObject.myFunction() and I want to match myFunction in a regular expression. If I want to match everything between two strings, the expression abc(.*)def works; so var str = ‘abc test def’;str.match(/.(.*)def/) would return [“abc test def”, “
Continue readingLookahead function syntax error (Regex)
Issue Hey guys I am getting a ‘invalid syntax’ popping up and it highlights the ‘?’ in my code. The ? is the meta character for the lookahead function but I don’t know why it is not working. Here is
Continue readingWindows gvim (74) syntax file, syntax not matching what it sould
Issue I am trying to create a vim syntax file (actually for gvim, but they should be very similar), but one of my matching groups does not match what it should. I need to match the literal “nop” or “NOP”
Continue readingCustom syntax highlighting in Atom
Issue As a self-exercise, I developed a simple assembler-like language. I’d like to add syntax highlighting for this in Atom. I have command, comments, and literals highlighting correctly, but for some reason my variables don’t highlight. Here is an example
Continue readingregex capture string only if keyword does not contain specific character
Issue I try to create a regex to capture some keyword for netlogo langage, in order to create a file for highlight.js. I’m not specialiste of regex, but i try to do that because there is no web syntax highlighter
Continue readingSyntax Highlighting with Elm
Issue I am writing a simple app that puts a syntax-highlighted block of code. For now I am using highlightjs do to the syntax highlighting for me. Why doesn’t my call to highlightBlock work here? For careful readers: my choice
Continue readingWrap a javascript generated html structure in a span with multiple instances of the end point
Issue I’ve been working on a syntax highlighter for a slightly modified version of Velocity. In short how can I wrap all the content starting at #inline() and ending with the corresponding #end under the condition that there can be
Continue readingSyntax highlighting with AvalonEdit
Issue I am trying to write a regex for AvalonEdit.TextEditor to mark everything after the second | a certain color. Example(value should be a color): action|key|value I am trying something like this but it doesn’t work because I can’t specify
Continue readingIn gedit, highlight a function call within the parenthesis
Issue I’m currently editing my javascript.lang file to highlight function names. Here is my expression for gtksourceview that I am currently using. <define-regex id=”function-regex” > (?<=([\.|\s])) ([a-z]\w*) (?=([\(].*))(?=(.*[\)])) </define-regex> here’s the regex by itself (?<=([\.|\s]))([a-z]\w*)(?=([\(].*))(?=(.*[\)])) It appears to work for
Continue readingRegex: find words following on "^\w+\s+" – New Syntax Definition (MMIX) – Sublime Text 3
Issue I am trying to create a syntax definition file for the MMIX assembler language. These files are used by Sublime Text 3 to highlight the syntax of a text/source file and as of late are written in YAML. Instructions
Continue readingVim positive look behind match pattern
Issue Here is the code: return ( <div></div> ) Notice there is a blank line above <div></div>. I want to match < in <div>. Here is what I have tried: Pattern \((\_s*\)\@<=< won’t work, but \((\_s*\)\zs< work. Pattern \((\_s*\)\@<=< work
Continue readingUse the ':' (0x3A) character in a Regex sentence?
Issue No, this is not a replicate of The ':' character, hexadecimal value 0x3A, cannot be included in a name I have a Regex for my syntax highlighter for my scripting language: `@”\bClass+(?<range>\w+?)\b”` which basically marks Class Name (with the
Continue readingC# AvalonEdit Highlighting Regex till new line
Issue I am modifying the Code from the AvalonEdit in C# to create another syntax highlighting. I want to create my own style for LOG-files the highlighted code looks like this: Time in the front blue and the text behind
Continue readingRegular Expressions particualrs for VSCode Syntax Highlighting
Issue I’m trying to write a sytnax highlighter for VSCode, which uses the TextMate format. I’ve got an entry for one-line comments, copied from an example, and it works fine, but I’d like to extend/modify it. “linecomment”: { “name”: “comment”,
Continue readingSublime Syntax Regex Only Highlight Match Within Delimiters
Issue I would like to match a string with regular expressions that occurs within specified delimiters, but not the delimiters themselves, for the purpose of syntax highlighting in a Sublime Text package. I am running ST3. For example, from the
Continue reading"split /\|/" breaks Perl syntax highlighting
Issue I code using Visual Studio Code on Ubuntu, with the Beautify and Perl extensions among others. An annoyance is that this bit of code, split /\|/ breaks the highlighter. I’m a bit lost about where to poke in vscode
Continue readingHow to highlight all R function names with highlight.js?
Issue I want to extend highlight.js capabilities for R language so that (1) all function names that are followed by opening parenthesis ( and (2) all package names that are followed by :: and ::: operators would be highlighted (as
Continue reading.Net regex matching $ with the end of the string and not of line, even with multiline enabled
Issue I’m trying to highlight markdown code, but am running into this weird behavior of the .NET regex multiline option. The following expression: ^(#+).+$ works fine on any online regex testing tool: But it refuses to work with .net: It
Continue readingHow to interleave two language support files in a tmLanguge file?
Issue I’m trying to make a VS Code extension to highlight Pollen Markup files. Those are plain text files with embedded variables and Racket code. Variables have syntax like this (and get later spliced into the text by a preprocessor):
Continue readingCan one automatically get Intellij's regex assistance for one's own regex parameters
Issue Intellij provides regex "assistance" (syntax checking) for parameters that expect regular expressions, eg coding: String[] array = string.split("(*."); will mark an error under the regex and provide a tool tip error: Unclosed group This also works for variables, eg
Continue readingSyntax Highlight Confusion / Fail in vim
Issue Suppose you have the following line in your .js(x) file and using VIM as your favourite text-editor if (foundArray = decodeURIComponent(location.hash).toLowerCase().match(/^#\/([0-9a-zäüöß\-_]+)?\/*$/i)) { The /* potion of that regex will cause VIM to grey out all of the following lines
Continue readingRegex pattern to produce appropriate escape character behavior
Issue I’m making a Sublime Text 3 language definition for syntax highlighting. The language is a simple ‘expression language’ (nothing to do with Java) that is used to display information from a media library on a display panel. The purpose
Continue readingFont-Lock an Emacs-Lisp Regexp Group
Issue I’m currently writing a major-mode for Emacs and am trying to figure out how to get syntax highlighting to work. My major-mode is for a lisp-like language that looks like this: [= a 3] [= [double x] [* x
Continue readingApply different scopes to the same character in a Sublime Text syntax definition file
Issue I’m trying to create a new .tmLanguage file for Sublime Text 2 that defines special fenced code blocks for knitr and Markdown. These blocks take this form: “`{r example_chunk, echo=true} x <- rnorm(100) y <- rnorm(100) plot(y ~ x,
Continue readingbbcode php code and highlighted source code using a php or javascript library
Issue I have a custom php website where I want to post php snippets but I’d like to have highlight my source code. I tried via pure php using Geshi (https://github.com/GeSHi/geshi-1.0) but it’s not as I wanted, so I’m interested
Continue readingSyntax highlighting rule to highlight the function reference in a Lisp function call
Issue I’m writing a syntax highlighting rules in Vim for Clojure, or another Lisp where (fn …) occurs mostly for function calls. I’m stuck at highlighting the first word of a function call, i.e. the function reference. Below is a
Continue readingWriting a syntax highlighter
Issue I was hoping to write my own syntax highlighter for a summer project I am thinking of working on but I am not sure how to write my own syntax highlighter. I know that there are bunch of implementations
Continue readingHow to use regex capture group inside a .nanorc file?
Issue How do I use a regex capture group inside a .nanorc file in combination with the color option? The Nanorc docs describe a color option, used to create syntax highlighting. color fgcolor,bgcolor regex For the currently defined syntax, display
Continue readingHow do I capture the 2nd match for each line?
Issue Basically, I need to match with 1 per line but right now, my regex is matching 2 per line. https://regex101.com/r/KmgGwS/8 My regex is looking for 2 slashes and it returns the string in between but the problem is my
Continue readingRegex to Match String Syntax in Code
Issue Let’s say, for example, there is a Python source code file like: def someStuff(): return “blabla” myThing = “Bob told me: \”Hello there!\”” twoStrings = “first part ” + “second part” How would I write a regular expression to
Continue readingCreate variable syntax highlighting for c++ st3
Issue So I want to implement variable syntax highlighting for my custom c++ theme on sublime text 3. So I wanted to create a custom scope to then use on my tmTheme file so I went to add to the
Continue readingVIM syntax highlight matching
Issue I noticed that C++ functions were not getting any styles applied to them with my vim stylings, so I figured it’d be simple to add a quick regex match to find any word immediately followed by a (, and
Continue readingMatching String Wrapped In Symbol For Regex Replace
Issue I’m trying to figure out how to implement Regex on my WordPress blog. The Problem I’d like to replace certain content with some inline styles, and I’m using Regex to accomplish this. My idea is as follows: find the
Continue readingMatch all instances of a character preceded by '/'
Issue for example, I might have the string /zombie nimble zombie quick Plants vs Zombies reference and I want to match every ‘e’ but only from the phrase "zombie nimble zombie quick", as it is preceded by a forward slash.
Continue readingWhy does this regular expression not work in Vim syntax highlighting?
Issue I am attempting to create my own Python syntax highlighting file for Vim. I’m trying to highlight the class inheritance object and the regex I’ve created works in various regex testers, but doesn;t work in Vim. I’ve read that
Continue readingHow to exclude occurrences after a positive lookbehind?
Issue Suppose I have the following markdown list items: – [x] Example of a completed task. – [x] ! Example of a completed task. – [x] ? Example of a completed task. I am interested to parse that item using
Continue readingvim syntax highlighting: region that starts with "#" and end with either "#" or end of line
Issue The situation I am in the process of writing a vim syntax file for a language that allows inline comments following this scheme: This is code # and here is comment # but this is code again The language
Continue readingRegular expression to match strings for syntax highlighter
Issue I’m looking for a regular expression that matches strings for a syntax highlighter used in a code editor. I’ve found (")(?:(?!\1|\\).|\\.)*\1 from here regex-grabbing-values-between-quotation-marks (I’ve changed the beginning since I only need double quotes, no single quotes) The above
Continue readingHow to get comments and string in regex?
Issue i have create a programming language KAGSA, and i have to create a syntax highlighter i start with VSCode highlighter i write every thing well but i have problem with regex of strings (more than one line) and comments
Continue readingMatch all GET url using angular-mocks for backendless
Issue I am writing a frontend without backend ajax for now. I am using angular-mocks to simulate API call like this: $httpBackend.when(‘GET’, ‘/somelink’).respond(function(method, url, data) { //do something }); However, if the ajax passes params: {id:12345}, it will append to
Continue readingNg-class – apply when URL includes certain string of characters
Issue I have the following in my controller; $scope.location = $location.absUrl(); This gives me the full URL of the current page being viewed. In my HTML I would like to apply a class if the URL contains a certain parameter.
Continue readingRegex: faulty syntax used with preg_replace_callback?
Issue I have borrowed code from this link PHP regex templating – find all occurrences of {{var}} to implement a means of applying values to template fiies. This uses the preg_replace_callback() function my preferred method of naming is name1.name2.name3=value, rather
Continue readingTemplating language, determine current scope
Issue I’m working with a tempting language that supports changing scope using special delimiters, like this: %% scope Foo %% Stuff %% end %% Blocks can be nested indefinitely like so: %% scope Foo %% Stuff in the Foo namespace
Continue readingA better way to do replacement tags in c#?
Issue I need a better way to do this: Regex.Replace(Regex.Replace(Regex.Replace(Regex.Replace(Regex.Replace(textMessage.Trim(), “{birthday}”, person.Birthday, RegexOptions.None), “{phone}”, person.MobilePhone, RegexOptions.None), “{email}”, person.Email, RegexOptions.None), “{lastname}”, person.LastName, RegexOptions.None), “{firstname}”, person.FirstName, RegexOptions.None) Solution textMessage.Trim() .Replace(“{birthday}”,person.Birthday) .Replace(“{phone}”,person.Phone) … Answered By – Reza ArabQaeni Answer Checked By – Gilberto
Continue readingReplace string with same named variable
Issue I wrote some days ago a simple thing to fallback to an placeholder image if the desired image can’t loaded. It allows the user to use 2 placeholders to to define the image size: That’s the thing I wrote:
Continue readingNeed to match <template>(anything)</template>
Issue Here’s the problem, The match must not also match (anything) (anything), only the first set. Here’s jsFiddle where I’ve been trouble shooting this. http://jsfiddle.net/UFTR2/ var templates = ‘<template mini-dash-ytd>’+ ‘<span class=”mini-dash-title”>{{title}}</span>’+ ‘<span class=”mini-dash-metric”>{{value}}</span>’+ ‘</template>’+ ‘<template mini-dash-yesterday>’+ ‘<span class=”mini-dash-title”>{{title}}</span>’+ ‘<span
Continue readingRegular expression matching unescaped paired brackets and nested function calls
Issue Here’s the problem: given a string like “<p>The price for vehicles {capitalize(pluralize(vehicle))} is {format_number(value, language)}</p><span>{employee_name}</span><span>\{do not parse me}</span>” I need (1) a regex pattern in PHP that matches all values between un-escaped pairs of curly brackets and (2) another
Continue readingTemplating if else endif php
Issue I made this failure regex to match if block for templating purpose! my if block is {if username == ‘admin’} Hello Admin {else} Hello visitor {endif} Or {if pagetitle == ‘about’} We are so and so! {endif} {else} block
Continue readingPhp regex: replacing localization string
Issue The Stackoverflow user Casimir et Hippolyte gave me this awesome function to replace strings like [[ Something ]] with localized strings being returned with $this->_() function. $that = $this; $view = preg_replace_callback(‘~\[\[\K(?>[^]]++|](?!]))*~’, function ($m) use ($that) { return $that->__($m[0]);
Continue readingFunctional way of finding inverse ranges
Issue I’m writing a templating utility for a library and trying to do it in a functional way (no mutable variables and ideally no intermediate state). This is mainly a learning exercise and I know there are libraries out there
Continue readinggrafana parse data from Templating parameter
Issue I have query : SELECT mean($Parameters) FROM “meter” WHERE “macid” =~ /^$macid$/ AND $timeFilter GROUP BY time($interval), “macid” fill(none) where $Parameters is templating value. value of $Parameters is “Description (field)” but I need to use not complete value of
Continue readingTemplate string from regex
Issue Let’s say that I have the following URL path: /api/resource/:id Given the context object {id: 1} the path will be transformed to /api/resource/1. Now I want to build a more complex path template: /api/resource/:id(/relationships/:name)? Here the relationships member is
Continue readingRegex find pattern between blocks
Issue I’m building a templating engine in PHP (Django like) that replaces everything between {{ }} with its related data. Right now I’m able to do that, but I’m facing a situation that requires a replacement only between blocks, such
Continue readingBest way to perform lite templating in php with regular expression
Issue Hi I’m trying to perform a very easy templating system in PHP. I wold to do this: Reading some .md file Change all {{ variables }} with a corrispondent variable in an array like $data( array(‘variable1’ => ‘value’, ‘variable2’
Continue readingIn PHP is there a better way to do dynamic templating
Issue I’m creating module for an application which will have simple custom templating with tags that will be replaced with data from a database. The field names will be different in each instance of this module. I want to know
Continue readingMaking a simple templating engine in PHP
Issue I need to write a simple PHP function to replace text between {{ }} characters with their respective data. Example: String: "and with strange aeons even {{noun}} may {{verb}}" $data = [‘noun’ => ‘bird’, ‘verb’ => ‘fly’]; Result: "and
Continue readingHow to use POSIX regexp in Spring Data Specification
Issue This is a Book that has "words" in the manner of "word1;word2;word3": @Entity @Table(name = "books") public class Book { … @Column(name ="words") private String words; } I need to find Books containing the specified word. I have: @Repository
Continue readingng-pattern issue with input type number
Issue I am facing one weird issue when trying to use ng-pattern with input type number. <input type=”number” name=”input” min=”0″ max=”1000″ data-ng-model=”input” ng-pattern=”/^[0-9]*$/”> <div data-ng-if=”Form.input.$error.pattern”>Please enter an Integer number between 0 and 1000.</div> </div> As per my regular expression defined,
Continue readingng-pattern should not match supplied pattern
Issue In ng-pattern we have the option of specifying that the field should match a specific pattern. How can we specify that it should NOT match the specified pattern? Example, <input type=”text” ng-pattern=”/[*|\”:<>[\]{}`()’;@&$]/” /> Here, I DONT want the field
Continue readinglooking for a regular expression to match specific decimal format in ng-pattern
Issue i am looking for a regular expression to put in ng-pattern attribute of angular. i am looking for an expression that satisfies only a specific decimal pattern i.e. exactly one digit –> than a decimal –> exactly 2 digits
Continue readingng-pattern (regex) to validate drive letters
Issue I’m having little hard time with a regular expression. Any help would be greatly appreciated. Problem: I want display an error when user enters drive letters in the path. for example: if user enters C:\ or D:\ or S:\
Continue readingRegular expression : match either of two conditions?
Issue Hi I don’t know much about regular expression. But I need it in form validation using angularJs. Below is the requirement The input box should accept only if either (1) first 2 letters alpha + 6 numeric or (2)
Continue readingAngularjs regular expression
Issue In my Angularjs application I need to have regular expression for two patterns for form validation with the following condition. Pattern 1 : The input box should accept alphanumeric with no space and it should also allow the user
Continue readingRegular Expression Generation for AngularJS ng-pattern
Issue I’m using a regex to validate a form input. So basically a user can input “SELECT some_name of select_match”. So far I have the regex: \bSELECT\b \bof select_match\b The last part is the middle part, which I think should
Continue readingRegex acts weird
Issue I want to create a regex expression that I can pass to ng-pattern so that the input can only be valid if the string has only uppercase/lowercase latin letters from a to z, n with tilde, and vowels with
Continue readingMatch an expression with no << or ]]
Issue I need to match the pattern only if << or >> or ]] or [[ is not present in the string. If any of these special characters are present the match should be zero else it should match. For
Continue readingRegular Expression for ng-pattern
Issue I want my input text to accept following characters only 1,2,3,4 and 5+ And to validate the above character I need a regular expression (ng-pattern). Is their any perfect website to learn Regular expression? Solution you can learn regular
Continue readingRegex digits with length and some specific characters
Issue I have a phone number input field where it must: Allows spaces and “-” and “+” characters. Have 12 characters max including the special characters (ex +12345678910). I tried but my best result was ng-pattern=”/^\+?\d{0,11}?$/”. How to make this
Continue readingHow to edit input style by using ng-pattern
Issue I made a small js here I also add the code to the Stack overflow snippet but for some reason it doesn’t work to me var myApp = angular.module(‘myApp’,[]); function MyCtrl($scope) { $scope.my_model = ” $scope.my_regex = ‘/^[A-Za-z]+(\,[A-Za-z]+)*$/’; $scope.my_placeHolder
Continue readingng-pattern for only hebrew characters
Issue I want to use ng-pattern validate my text input field that should accept only Hebrew characters, sometimes the input are ok and sometimes they are being rejected for some reason. (the first one is validate the second letter is
Continue readingspicy angularjs regex
Issue I’ve been working on a regex problem for angularJs ng-pattern which needs: Cannot be blanks A minimum of 1 character and a maximum of 32 characters Spaces ONLY are not allowed Acceptable special characters(!@#$%&*-+=[]:;’,.? ) The answer is not
Continue readingregex for multiple IPs comma separated with or without subnet
Issue I have regex for IPv4 address: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$ and i have regex for IPv4 CIDR range : ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(/([0-9]|[1-2][0-9]|3[0-2]))$ the issue is how should i repeat it using comma separated pattern: XXX.XXX.XXX.XXX, XXX.XXX.XXX.XXX/XX, XX.XX.XX.XX, XX.XX.XX.XX/X , XX.XX.XX.X test data– 123.123.13.11, 1.0.0.0,
Continue readingng-pattern with regex having double quotes does not escape correctly
Issue I have a ng-pattern validation for a regex of ^[^\./:*\?\”<>\|]{1}[^\/:*\?\”<>\|]{0,254}$ which basically tests the invalid chars in filepath and teh limit. but when i have the ng-pattern specified as ng-pattern = “^[^\\\./:\*\?\”<>\|]{1}[^\\/:\*\?\”<>\|]{0,254}$” , the ng-pattern shows the regex in
Continue readingRegex to split a long expressions string into an array of individual expressions
Issue I have an expression string from Angular [ngClass] directive containing multiple expressions with their corresponding key separated by a comma. ‘background_orange’:row.columnname.split(‘,’)[4] == 1,’red:color’:test===’testname’,’yellow:color’:test===’testname’ When I try to split the above expression string into an array of individual expression with
Continue readingHow can I remove text at beginning of a file using a regex?
Issue I have a bunch of files that contain a semi-standard header. That is, the look of it is very similar but the text changes somewhat. I want to remove this header from all of the files. From looking at
Continue readingvalidate natural input number with ngpattern
Issue I use ng-pattern=”/0-9/” to set price_field do not accept decimal number. But when I input natural number (from 0 to 9999999),ng-show gets activated with Not valid number!. Where did I go wrong?. Please help. <form name=”myform” data-ng-submit=”create()”> <input type=”number”
Continue readingProper Nginx regex for redirection of URLs with double hyphen
Issue This is my first post ever. Hopefully, I’ll be able to explain my problem thouroughly. I have an Nginx config that redirects my.domain.com/avocado to my.domain.com/avocado/ (with a slash in the end). This also redirect subpaths (end with a slash)
Continue readingRedirecting captured regex group using nginx
Issue With the following nginx location directive location ~* (.*)(\/graphql)$ { proxy_pass http://my-backend:80/$2; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; } I expect that URLs like https://example.com/anything/graphql is redirected to http://my-backend:80/$2 but that’s not the case
Continue readingRegular expression for accepting integers, decimal values and limiting by maximum value
Issue I need a regular expression that accept only integers or decimals from 1 to 9999.99. I tried this ^(?:[1-9][0-9]{0,4}(?:.d{1,2})?|9999|9999.99)$ but it is also accepting 10000. Solution There are a few issues in the pattern: This part [1-9][0-9]{0,4} can match
Continue readingHow to use parameters containing a slash character?
Issue My MongoDB keys in person collection are like this: TWITTER/12345678 GOOGLE/34567890 TWITTER/45678901 … I define getPersonByKey route this way: router.route(‘/getPersonByKey/:providerKey/:personKey’). get(function(req, res) { // get person by key var key = req.params.providerKey + ‘/’ + req.params.personKey; // … }
Continue readingRegex longitude and latitude (GPS format)
Issue I want to force the user to enter a value for longitude and latitude (GPS format) in a valid format like Degree:Minute:Second => xx°yy,yy. For example 43°06,57 I will use it in HTML <input type="text" pattern="<regex>"/> Sorry I forgot
Continue readingstring search returning 0
Issue I created a regex using minimatch library in nodeJs. I wanted to find Date’s in the string. minimatch.makeRe("*/*/*") It returned /^(?:(?!\.)(?=.)[^/]*?\/(?!\.)(?=.)[^/]*?\/(?!\.)(?=.)[^/]*?)$/ But when I use the regex in string.search method it is returning 0. let text = "Some Test
Continue reading