Matches function declarations and captures function names from
`.d` Source Code file
**regexcapture.d**
```
import std.stdio : writeln;
import std.regex : matchAll, regex;
import std.file : read;
void main(){
string input = cast(string)read("sourcecode.d");
foreach(match
eed two dots to match two characters?
Each dot being the regex to match a single character,
so `r"^.."` instead of `r"^."` to get the first two characters.
When I run your program (on linux with rdmd from DMD 2.106.0),
I get:
[["H"]]
Yeah, that's true,
BoQsc via Digitalmars-d-learn wrote:
This is something I've searched on the forum and couldn't find exact
answer.
TLDR: `r"^."` is matching the very first two character in the `input`
string.
Don't you need two dots to match two characters?
Each dot being th
This is something I've searched on the forum and couldn't find
exact answer.
TLDR: `r"^."` is matching the very first two character in the
`input` string.
**matchtest.d**
```
import std.stdio : writeln;
import std.regex : matchAll;
import std.file : read;
void main(){
string input
On 4/6/23 11:08, Paul wrote:
ways to access
those repetitive ", cc" s on the end. I don't think my regex is
capturing them.
Some internets think you are in parser territory:
https://stackoverflow.com/questions/1407435/how-do-i-regex-match-with-grouping-with-unknown-number-of-groups
Ali
(current
line that matches), c[1] will contain the first captured match
("AA" for first line), c.front[2] will contain "0" for first
line, etc.
Thanks Alex. Read some more and tried some different ways to
access those repetitive ", cc" s on the end. I don't think my
regex is capturing them.
On Thursday, 6 April 2023 at 15:52:16 UTC, Paul wrote:
My regex is matching but doesnt seem to be capturing. You may
recognize this from the AOC challenges.
file contains...
**Valve AA has flow rate=0; tunnels lead to valves DD, II, BB**
**Valve BB has flow rate=13; tunnels lead to valves CC
My regex is matching but doesnt seem to be capturing. You may
recognize this from the AOC challenges.
file contains...
**Valve AA has flow rate=0; tunnels lead to valves DD, II, BB**
**Valve BB has flow rate=13; tunnels lead to valves CC, AA**
**Valve CC has flow rate=2; tunnels lead to valves
On Monday, 20 March 2023 at 17:47:19 UTC, Adam D Ruppe wrote:
On Monday, 20 March 2023 at 17:42:17 UTC, Paul wrote:
Do we have some such function in our std library?
Try
static import std.file;
string s = std.file.readText("filename.txt");
http://phobos.dpldocs.info/std.file.readText.html
On Monday, 20 March 2023 at 17:42:17 UTC, Paul wrote:
Do we have some such function in our std library?
Try
static import std.file;
string s = std.file.readText("filename.txt");
http://phobos.dpldocs.info/std.file.readText.html
I've been looking through our Library documentation and having
trouble finding what I want. **I'd like to read a text file in
all at once** and do some searching and analytics on it instead
of reading it bit by bit or line by line. Do we have some such
function in our std library?
Thanks in
corresponding regular
expression, here is the code I currently have:
[...]
storing the regex in a token is an antipattern.
Thank you for the answer,
I know it's not clean, I'll modify my code to define a token type
table with their regular expression and define a token type table
wit
have:
[...]
storing the regex in a token is an antipattern.
{
/// The token type
string type;
/// The regex to match the token
Regex!char re;
/// The matched string
string matched = null;
}
/// Function to find the right token in the given table
Token find(Token[] table, const(Captures!string delegate(Token)
pure @safe) fn
"ab\w" or "(?Pregex)" should be parsing: [ "a",
"b", "\w" ], [ "(", "?", "P", "", "regex", ")"]..., i
think.
up.
{
last = m;
}
matchedLength = last.hit.length;
return last.pre.length;
}
}
Thank!
Fastest solution wanted!
May be... some like a "RightToLeft" in Win32 API...
https://docs.microsoft.com/en-us/dotnet/api/system.text.regularexpressions.regexoptions?view=net-5.0#System_Text_RegularExpressions_RegexOptions_RightToLeft
but how on Linux? MS-regex and Linux-regex is identical ?
On Saturday, 19 December 2020 at 12:52:54 UTC, Виталий Фадеев
wrote:
Goal:
size_t pos = findRegexBackward( r"abc"d );
assert( pos == 4 );
module LastOccurrence;
size_t findRegexBackward_1 (dstring s, dstring pattern)
{
import std.regex : matchAll;
auto results = matchAll (s, pat
We have:
dstring s = "abc3abc7";
Source:
https://run.dlang.io/is/PtjN4T
Goal:
size_t pos = findRegexBackward( r"abc"d );
assert( pos == 4 );
How to find regex in backward direction ?
On Saturday, 12 December 2020 at 12:03:49 UTC, kdevel wrote:
I don't have a suggestion for better wording yet.
[1] https://dlang.org/phobos/std_regex.html
This [1] is how I would word it.
[1] https://github.com/dlang/phobos/pull/7724
On Saturday, 12 December 2020 at 12:03:49 UTC, kdevel wrote:
In some situations a ] must be escaped as in
auto re = regex(`^[a\]]$`); // match a and ] only
Unfortunately dmd/phobos does not warn if you forget the
backslash:
auto re = regex(`^[a]]$`); // match a]
This leads me to the
In some situations a ] must be escaped as in
auto re = regex(`^[a\]]$`); // match a and ] only
Unfortunately dmd/phobos does not warn if you forget the
backslash:
auto re = regex(`^[a]]$`); // match a]
This leads me to the documentation [1] which says
\c where c is one of
0) Run the script with some options
1) sed/grep regex to catch a portion of a file.
For example: it finds the line that match "1234" and take
all the lines until the line that match "abcd".
2) sed regex to catch some strings
For example: "abc sdfs#=8 // some text&qu
I've to convert a linux dash script because it is too slow and i
decded to do it in D. I'm totally new to this and i think it
could be a good exercise to learn this language.
The shell script does some simple jobs like:
0) Run the script with some options
1) sed/grep regex to catch
hat extra '+' in the regex pattern:
std.regex.split(l, ctRegex!`[\s-\)\(\.]+`)
Ali
On 2/20/20 2:02 PM, AlphaPurned wrote:> std.regex.split(l,
ctRegex!`[\s-\)\(\.]`);
>
> I'm trying too split a string on spaces and stuff... but it is returning
> empty strings and other matches(e.g., ()).
>
> I realize I can delete afterwards but is there a direct way from split
> or ctRegex?
It
std.regex.split(l, ctRegex!`[\s-\)\(\.]`);
I'm trying too split a string on spaces and stuff... but it is
returning empty strings and other matches(e.g., ()).
I realize I can delete afterwards but is there a direct way from
split or ctRegex?
On Monday, 3 February 2020 at 07:11:34 UTC, Dharmil Patel wrote:
On Monday, 3 February 2020 at 07:03:03 UTC, Dharmil Patel wrote:
In my code I am using regex like this:
auto rgxComma = regex(r",");
On compiling with dmd v2.076.1, it compiles successfully, but
on compilin
On Monday, 3 February 2020 at 07:03:03 UTC, Dharmil Patel wrote:
In my code I am using regex like this:
auto rgxComma = regex(r",");
On compiling with dmd v2.076.1, it compiles successfully, but
on compiling with dmd v2.088.1, I am getting lots of errors
like:
/src/phobos
In my code I am using regex like this:
auto rgxComma = regex(r",");
On compiling with dmd v2.076.1, it compiles successfully, but on
compiling with dmd v2.088.1, I am getting lots of errors like:
/src/phobos/std/regex/internal/thompson.d-mixin-836(837): Error:
templat
On 1/7/20 11:00 AM, Taylor Hillegeist wrote:
On Tuesday, 7 January 2020 at 15:51:21 UTC, MoonlightSentinel wrote:
On Tuesday, 7 January 2020 at 15:40:58 UTC, Taylor Hillegeist wrote:
but I can't get it to work. it says its an Error: non-constant
expression.
I imagine this has to do with the c
On Tuesday, 7 January 2020 at 15:40:58 UTC, Taylor Hillegeist
wrote:
I'm trying to trick the following code snippet into compilation.
enum TokenType{
//Terminal
Plus,
Minus,
LPer,
RPer,
Number,
}
static auto Regexes =[
TokenType.Plus: ctRegex!
re is a better way? Does anyone know?
This issue is unrelated to ctRegex, AA literals are
non-constant expressions (probably due to their
implementation). You can work around this by using module
constructors or lazy initialisation inside of a function:
static Regex!char[TokenType] Re
Regex, AA literals are non-constant
expressions (probably due to their implementation). You can work
around this by using module constructors or lazy initialisation
inside of a function:
static Regex!char[TokenType] Regexes;
shared static this()
{
Regexes = [
TokenType.Plus: ct
I'm trying to trick the following code snippet into compilation.
enum TokenType{
//Terminal
Plus,
Minus,
LPer,
RPer,
Number,
}
static auto Regexes =[
TokenType.Plus: ctRegex!(`^ *\+`),
TokenType.Minus: ctRegex!(`^ *\-`),
TokenType.LPer:
On Thursday, 3 October 2019 at 23:47:17 UTC, Brett wrote:
Error: static variable `thompsonFactory` cannot be read at
compile time
std.regex isn't ctfe compatible, alas.
even the ctRegex doesn't work at ctfe; it *compiles* the regex at
compile time, but it is not capable of actuall
On Friday, 4 October 2019 at 10:07:40 UTC, kinke wrote:
Have you tried ctRegex?
Yes, just another error about something else that I don't
remember.
Have you tried ctRegex?
auto r = replaceAll!((C)
{
return "X";
}
)(s, regex(`Y`));
Error: static variable `thompsonFactory` cannot be read at
compile time
Error: static variable `thompsonFactory` cannot be read at
compile time, Trying to regex an import file.
Also I have a group (...)* and it always fails or matches only
one but if I do (...)(...)(...) it matches all 3(fails if more or
less of course. ... is the regex).
Also when I ignore a
Having to split and match seems slow(50%). Surely the regex
splitter and matcher can be combined? Sometimes we just need to
extract out and remove information simultaneously.
I propose a new function called extractor that returns the
matchAll and splitter's results but is optimized.
On Thursday, 4 April 2019 at 10:31:43 UTC, Julian wrote:
On Thursday, 4 April 2019 at 09:57:26 UTC, rikki cattermole
wrote:
If you need performance use ldc not dmd (assumed).
LLVM has many factors better code optimizes than dmd does.
Thanks! I already had dmd installed from a brief look at D
On Thu, Apr 04, 2019 at 09:53:06AM +, Julian via Digitalmars-d-learn wrote:
[...]
> auto re = ctRegex!(r"(?:\S+ ){3,4}<= ([^@]+@(\S+))");
[...]
ctRegex is a crock; use regex() instead and it might actually work
better.
T
--
Stop staring at me like that! It's
On Thursday, 4 April 2019 at 10:31:43 UTC, Julian wrote:
On Thursday, 4 April 2019 at 09:57:26 UTC, rikki cattermole
wrote:
If you need performance use ldc not dmd (assumed).
LLVM has many factors better code optimizes than dmd does.
Thanks! I already had dmd installed from a brief look at D
On Thursday, 4 April 2019 at 09:57:26 UTC, rikki cattermole wrote:
If you need performance use ldc not dmd (assumed).
LLVM has many factors better code optimizes than dmd does.
Thanks! I already had dmd installed from a brief look at D a long
time ago, so I missed the details at
https://dlang
On Thursday, 4 April 2019 at 09:53:06 UTC, Julian wrote:
Relatedly, how can I add custom compiler flags to rdmd, in a D
script?
For example, -L-lpcre
Configuration variable "DFLAGS". On Windows you can specify it in
the sc.ini file. On Linux: https://dlang.org/dmd-linux.html
If you need performance use ldc not dmd (assumed).
LLVM has many factors better code optimizes than dmd does.
The following code, that just runs a regex against a large exim
log
to report on top senders, is 140 times slower than similar C code
using
PCRE, when compiled with just -O. With a bunch of other flags I
got it
down to only 13x slower than C code that's using libc
regcomp/regexec.
i
On Saturday, 23 June 2018 at 13:45:32 UTC, Basile B. wrote:
On Saturday, 23 June 2018 at 12:17:08 UTC, biocyberman wrote:
I get the same output with or without "g" flag at line 6:
https://run.dlang.io/is/9n7iz6
So I don't understand when I have to use "g" flag.
My
On Saturday, 23 June 2018 at 12:17:08 UTC, biocyberman wrote:
I get the same output with or without "g" flag at line 6:
https://run.dlang.io/is/9n7iz6
So I don't understand when I have to use "g" flag.
My bet is that Regex results in D are lazy so "g"
On Saturday, 23 June 2018 at 12:50:17 UTC, biocyberman wrote:
On Saturday, 23 June 2018 at 12:20:10 UTC, biocyberman wrote:
I got "Error: undefined identifier flags" in here:
https://run.dlang.io/is/wquscz
Removing "flags =" works.
I kinda found an answer. It's a bit of a surprise anyway:
On Saturday, 23 June 2018 at 12:20:10 UTC, biocyberman wrote:
I got "Error: undefined identifier flags" in here:
https://run.dlang.io/is/wquscz
Removing "flags =" works.
I kinda found an answer. It's a bit of a surprise anyway:
https://forum.dlang.org/thread/wokfqqbexazcguffw...@forum.dlang
I got "Error: undefined identifier flags" in here:
https://run.dlang.io/is/wquscz
Removing "flags =" works.
I get the same output with or without "g" flag at line 6:
https://run.dlang.io/is/9n7iz6
So I don't understand when I have to use "g" flag.
On Wednesday, 28 February 2018 at 05:09:03 UTC, psychoticRabbit
wrote:
On Wednesday, 28 February 2018 at 01:06:30 UTC, dark777 wrote:
Regex validates years bisexto and not bisextos in format:
const std::regex
pattern(R"(^(?:(?:(0?[1-9]|1\d|2[0-8])([-/.])(0?[1-9]|1[0-2]|[Jj](?:an|u[nl])|
On Wednesday, 28 February 2018 at 01:06:30 UTC, dark777 wrote:
Regex validates years bisexto and not bisextos in format:
const std::regex
pattern(R"(^(?:(?:(0?[1-9]|1\d|2[0-8])([-/.])(0?[1-9]|1[0-2]|[Jj](?:an|u[nl])|[Mm]a[ry]|[Aa](?:pr|ug)|[Ss]ep|[Oo]ct|[Nn]ov|[Dd]ec|[Ff]eb)|(29|30)([-/
Regex validates years bisexto and not bisextos in format:
const std::regex
pattern(R"(^(?:(?:(0?[1-9]|1\d|2[0-8])([-/.])(0?[1-9]|1[0-2]|[Jj](?:an|u[nl])|[Mm]a[ry]|[Aa](?:pr|ug)|[Ss]ep|[Oo]ct|[Nn]ov|[Dd]ec|[Ff]eb)|(29|30)([-/.])(0?[13-9]|1[0-2]|[Jj](?:an|u[nl])|[Mm]a[ry]|[Aa](?:pr|ug)|[Ss]e
On Saturday, 16 September 2017 at 03:23:14 UTC, Adam D. Ruppe
wrote:
On Saturday, 16 September 2017 at 03:18:31 UTC, Ky-Anh Huynh
wrote:
Is there a way to transform user input string to a regular
expression? For example, I want to write a `grep`-like program
import std.regex;
auto re = regex
On Saturday, 16 September 2017 at 03:18:31 UTC, Ky-Anh Huynh
wrote:
Is there a way to transform user input string to a regular
expression? For example, I want to write a `grep`-like program
import std.regex;
auto re = regex(user_pattern, user_flags);
You'll probably want to split it o
Hi,
Is there a way to transform user input string to a regular
expression? For example, I want to write a `grep`-like program
```
mygrep -E '/pattern/i' file.txt
```
and here the user's parameter `/pattern/i` would be converted to
a Regex object.
Fyi, in Ruby, `to_regexp`
I was working around with regex trying to match certain patterns
of repeating patterns before and after a space and I came across
some unexpected behavior.
writeln("ABC ABC CBA".replaceAll(regex(r"([A-Z]) ([A-Z])"),
"D"));
//ABDBDBA
//Makes se
On 14/04/2017 3:54 AM, Jethro wrote:
using the rule (?Pregex)
e.g., (?P\w*)*
how do we get at all the matches, e.g., Joe Bob Buddy?
When I access the results captures they are are not arrays and I only
ever get the first match even when I'm using matchAll.
Pseudo code:
foreach(result; match
using the rule (?Pregex)
e.g., (?P\w*)*
how do we get at all the matches, e.g., Joe Bob Buddy?
When I access the results captures they are are not arrays and I
only ever get the first match even when I'm using matchAll.
an associative
array (AA) with all named captures that successfully matched
during a regex match (and none of the captures that failed). I
was wondering what the best way to do this might be.
Thanks!
Please see comments in the below program for details and my
current progress:
void main()
{
So I have ran into an issue where I want to replace a string with
regex.
but i cant figure out how to replace items followed by a number.
i use "$1001" to do paste first match but this thinks I'm trying
using match 1001
but if i try ${1}001 it gives me an error saying that it
ch does
not properly support the particular backreference but bmatch
does, the bug is in using the incorrect one to handle a pattern.
At any rate, wrong result with a 8-character pattern produces a
"regex don't work" impression, and I hope something can be done
about it.
cym13 wrote:
> Is it that you
> can't make an immutable regex()? In that case it is a
> runtime-related issue and those variables just have to be
> mutable. Or is it that you want to be able to use an immutable or
> const regex (be it from regex() or ctRegex!()) with matchAl
at
you meant by "the same error" is the « Error: template
std.regex.matchAll cannot deduce function from argument types
!()(string, const(StaticRegex!char)) » one. But that error has
nothing to do with the first one (« Error: cannot implicitly
convert expression (regex("\\d+", &q
On Saturday, 2 January 2016 at 02:39:36 UTC, Shriramana Sharma
wrote:
Aw come on. The immutability of the variable is *after* it has
been created at runtime.
Sure, but still...
> you'll find that using
ctRegex() instead will allow you to declare it immutable for
example. I didn't look at the
cym13 wrote:
> I think it's because regex() only compiles the regex at runtime
> so it needs to be modified later ;
Aw come on. The immutability of the variable is *after* it has been created
at runtime.
> > you'll find that using
> ctRegex() instead will allow you to
On Saturday, 2 January 2016 at 02:03:13 UTC, Shriramana Sharma
wrote:
Shriramana Sharma wrote:
Why is it impossible for a Regex object to be
`immutable`?
I find that I can't declare it as `const` either... This is
most curious!
I think it's because regex() only compiles th
Hello. With this code:
import std.stdio, std.regex;
void main()
{
immutable numbers = regex(r"\d+");
foreach (match; "a1b2c3d4e5".matchAll(numbers))
writeln(match[0]);
}
compiling gives the error:
(4): Error: cannot implicitly convert expression (regex(&
Shriramana Sharma wrote:
> Why is it impossible for a Regex object to be
> `immutable`?
I find that I can't declare it as `const` either... This is most curious!
--
Shriramana Sharma, Penguin #395953
On 30.12.2015 12:06, Ivan Kazmenko wrote:
import std.regex, std.stdio;
void main ()
{
writeln (bmatch ("abab", r"(..).*\1")); // [["abab", "ab"]]
writeln (match("abab", r"(..).*\1")); // [["abab", "ab"]]
writeln (matchAll ("abab", r"(..).*\1")); // [["abab", "ab"]]
On Wednesday, 30 December 2015 at 11:06:55 UTC, Ivan Kazmenko
wrote:
...
As you can see, bmatch (usage discouraged in the docs) gives me
the result I want, but match (also discouraged) and matchAll
(way to go) don't.
Am I misusing matchAll, or is this a bug?
Reported as https://issues.dlan
Hi,
While solving Advent of Code problems for fun (already discussed
in the forum:
http://forum.dlang.org/post/cwdkmblukzptsrsrv...@forum.dlang.org), I ran into an issue. I wanted to test for the pattern "two consecutive characters, arbitrary sequence, the same two consecutive characters". Sa
llowing style works for me:
import std.stdio;
import std.string;
import std.regex;
import std.array;
void main() {
auto data = [ "abc=1", "def=2", "xyz=3" ];
/* Matches patterns like a=1
*
* Note the parentheses around the two pattern
I can't understand how to replace in regex. I have got next task:
find all commas in strings inside quotes and replace them.
foo, bar, "hello, user", baz
I wrote next regexp that find part that include commas inside the
quotes:
auto partWithComma = matchAll(line, r);
but I c
On 23/11/15 9:30 PM, yawniek wrote:
regex from
https://github.com/ua-parser/uap-core/blob/master/regexes.yaml#L38
seems to work in other languages, not so in D:
auto r2 = r"(?:\/[A-Za-z0-9\.]+)? *([A-Za-z0-9
_\!\[\]:]*(?:[Aa]rchiver|[Ii]ndexer|[Ss]craper|[Bb]ot|[Ss]pider|[Cc]rawl[a-z]*)
x27;ll increase performance
significantly.
that was my plan.
Reguarding regex, if you want a named sub part use:
(?[a-z]*)
Where [a-z]* is just an example.
I would recommend you learning how input ranges work. They are used
with how to get the matches out, e.g.
auto rgx = ctRegex!`([a-z])[123]`
regex from
https://github.com/ua-parser/uap-core/blob/master/regexes.yaml#L38
seems to work in other languages, not so in D:
auto r2 = r"(?:\/[A-Za-z0-9\.]+)? *([A-Za-z0-9
_\!\[\]:]*(?:[Aa]rchiver|[Ii]ndexer|[Ss]craper|[Bb]ot|[Ss]pider|[Cc]rawl[a-z]*)) (\d+)(?:\.(\d+)(?:\.(\d+))?)?&q
e significantly.
that was my plan.
Reguarding regex, if you want a named sub part use:
(?[a-z]*)
Where [a-z]* is just an example.
I would recommend you learning how input ranges work. They are
used with how to get the matches out, e.g.
auto rgx = ctRegex!`([a-z])[123]`;
foreach(match; r
significantly.
Reguarding regex, if you want a named sub part use:
(?[a-z]*)
Where [a-z]* is just an example.
I would recommend you learning how input ranges work. They are used with
how to get the matches out, e.g.
auto rgx = ctRegex!`([a-z])[123]`;
foreach(match; rgx.matchAll("b3")
hi!
how can i format a string with captures from a regular
expression?
basically make this pass:
https://gist.github.com/f17647fb2f8ff2261d42
context: i'm trying to write a implementation for
https://github.com/ua-parser
where the regular expression as well as the format strings are
given.
Ali Çehreli wrote:
> Meanwhile, can you try the following template which works at least for
> the reduced code:
>
> import std.range;
>
> auto foo(S)(S text)
> if (isSomeString!S) {
> import std.regex;
> static auto inlineRE = ctRegex!`\$\(ta (.*?)\)`;
> return text.replaceAll!(m => textAttr(m[1
On 10/16/2015 07:06 PM, Shriramana Sharma wrote:
> /usr/include/dmd/phobos/std/regex/package.d(557): Error: variable
> std.regex.RegexMatch!(inout(char)[],
BacktrackingMatcher).RegexMatch._input
> only parameters or stack based variables can be inout
Reduced:
inout(char)[] foo(i
stdio;
if (args.length == 1) return;
alias ta = textAttr;
writeln(ta(args[1 .. $]), "text1", ta("u g /w"), "text2", ta("off"));
}
Now upon trying to compile this I'm getting the errors:
$ dmd inout_test.d
/usr/include/dmd/phobos/std/regex/package
Thanks Adam, that was the hint I needed. For a given RegexMatch
the pre().length() is essentially equivalent to the start
position and taking pre().length + hit.length() gives the end
position so I think this should be OK for my needs.
On Thursday, 1 October 2015 at 03:29:29 UTC, Gerald wrote:
I'm stuck though on how to get the start/end index of a match?
I couldn't find one either so I did the pre/post/hit things
broken up.
Take a look at this little program I wrote:
http://arsdnet.net/dcode/replacer/
All the files it n
I'm using the std.regex API as part of Linux GUI grep utility I'm
trying to create. I've got the GUI going fine using gtkd, the
code to iterate over files (wow that was succinct in D, very
impressive!), and getting matches via regex using the matchAll
function.
I'm stuck
On Monday, 25 May 2015 at 11:20:46 UTC, novice2 wrote:
I cannot get the longest possible
it match longest for first group ([a-z]+)
try
^([a-z]+?)(hula|ula)$
Namespace, novice2:
Ah, I see. The problem was with the first group that was too
greedy, not with the second. I was focusing on the l
I cannot get the longest possible
it match longest for first group ([a-z]+)
try
^([a-z]+?)(hula|ula)$
On Monday, 25 May 2015 at 11:11:50 UTC, Chris wrote:
I'm a bit at a loss here. I cannot get the longest possible
match. I tried several versions with eager operators and stuff,
but D's regex engine(s) always seem to return the shortest
match. Is there something embarrassingly
I'm a bit at a loss here. I cannot get the longest possible
match. I tried several versions with eager operators and stuff,
but D's regex engine(s) always seem to return the shortest match.
Is there something embarrassingly simple I'm missing?
void main()
{
import st
On Saturday, 25 April 2015 at 09:30:55 UTC, Dmitry Olshansky
wrote:
A quick investigation shows that it gets stuck at the end of
pattern compilation stage.
The problem is that as a last pass D's regex goes to optimize
the pattern to construct simple bit-scanning engine as
approximatio
On Friday, 24 April 2015 at 18:28:16 UTC, Guillaume wrote:
Hello, I'm trying to make a regex comparison with D, based off
of this article: https://swtch.com/~rsc/regexp/regexp1.html
I've written my code like so:
import std.stdio, std.regex;
void main(string argv[]) {
strin
On Friday, 24 April 2015 at 18:28:16 UTC, Guillaume wrote:
Hello, I'm trying to make a regex comparison with D, based off
of this article: https://swtch.com/~rsc/regexp/regexp1.html
I've written my code like so:
import std.stdio, std.regex;
void main(string argv[]) {
strin
Hello, I'm trying to make a regex comparison with D, based off of
this article: https://swtch.com/~rsc/regexp/regexp1.html
I've written my code like so:
import std.stdio, std.regex;
void main(string argv[]) {
string m = argv[1];
auto p =
ctRegex!("a?a?a?a?a?a?a?a?a?
On Wed, 31 Dec 2014 15:36:16 +
Darrell via Digitalmars-d-learn
wrote:
> So far attempts to run regex on binary data causes
> "Invalid UTF-8 sequence".
>
> Attempts to pass ubyte also didn't work out.
current regex engine assumes that you are using UTF-8 encode
On Wednesday, 31 December 2014 at 15:36:19 UTC, Darrell wrote:
So far attempts to run regex on binary data causes
"Invalid UTF-8 sequence".
Attempts to pass ubyte also didn't work out.
I doubt using anything except (d,w)string is supported or
possible.
So far attempts to run regex on binary data causes
"Invalid UTF-8 sequence".
Attempts to pass ubyte also didn't work out.
1 - 100 of 270 matches
Mail list logo