Overview We are given an input regex and an input string. Regex can have two special characters Star Sign ‘*’ – the star matches zero or more characters. Question Mark ‘?’ –…
Posts
Print/Output text in italic in Ruby Language
Overview ANSI escape codes can be used to output bold text in the console. Please note that In MAC/Linux system terminal supports ANSI escape codes Windows Command Prompt doesn’t support it. On windows,…
Print/Output text in bold in Ruby Language
Overview ANSI escape codes can be used to output bold text in the console. Please note that In MAC/Linux system terminal supports ANSI escape codes Windows Command Prompt doesn’t support it. On windows,…
Load a .env or environment file in Ruby Language
Overview dotenv gem can be used to load .env or environment file in ruby https://github.com/bkeepers/dotenv It takes a variable number of arguments where each argument can be the .env filenames that it…
Print/Output color in the console in Ruby Language
Overview We can use the colorize gem for the same https://github.com/fazibear/colorize Just install the Gem Program Output You can also check all color options by running the below code It will output
Turn a file path into a hyperlink in the terminal in RubyMine using Ruby Language
Overview We can prefix the file path with file:// to make it clickable in the terminal in the ruby mine editor For example, below is how we will make the complete link…
Understanding Curly Braces in Regular Expressions or Regex
Overview Curly braces act as a repetition quantifier in regex. They specify the number of times a character before preceding it can appear in the input string or text. They can also be…
Execute System Commands in Ruby Language
Overview Ruby’s system method can be used to run system commands in Ruby. Below is the syntax for the same Some important points to note about system command It will wait until…
Ruby Regex: Match any character in Regular Expression
Overview Dot ‘.’ character is one of the most commonly used metacharacters in the regular expression. It is used to match any character. By default, it doesn’t match a new line. Now…
Ruby Regex or Regular Expression in a variable
Overview In Ruby, a regular expression is defined between two forward slashes. This is a way to differentiate a regular expression from a normal string. This is how a regex will be…