Introducing Regexps

Back to General discussions forum

David Epper Marshall     2021-11-17 14:38:12

Submitting my code I get: Expected answer was

Sorry, for test data<br/><br/>1010B
016116
1idh
0X1
1a51h
0b100
2011b
102101011B
111011111011b
04214
48h
72
1011101010b
1202121B
101101100100b
8h
0b10011
012
BG6H
2
0116
01436
0X22
4AC
14dh
1000B
0B1011010
1001B
0X53
0x23
0B101
0B11
1B
7
0x49
8
0x39<br/><br/>Your code returned<br/><br/>1010B 016116 1idh 0X1 1a51h 0b100 2011b 102101011B 111011111011b 04214 48h 72 1011101010b 1202121B 101101100100b 8h 0b10011 012 BG6H 2 0116 01436 0X22 4AC 14dh 1000B 0B1011010 1001B 0X53 0x23 0B101 0B11 1B 7 0x49 8 0x39<br/><br/>instead of<br/><br/>bin oct 1idh hex hex bin 2011b 102101011B bin oct hex dec bin 1202121B bin hex bin oct BG6H dec oct oct hex 4AC hex bin bin bin hex hex bin bin bin dec hex dec hex

Your answer was:

0b12 oct bin dec 10AIH oct hex hex bin hex bin bin dec 3B3C oct hex hex dec 20111021b hex oct 0b1012211 06957 102220b 05862 0b21 hex bin hex hex bin dec bin

Your input data:

43
6708
19C
202212b
0x1
20111221b
0x18ae
1b
0B1010011
34H
01147
0XG95
11111010B
21b
0B1010
54
110110100101B
0X53
049
1H
1b2h
2DH
0B101
20C1H
0x2
0b11110000
579H
5i9h
101b
100B
1BIH

If I click try again and enter the test data and run against my code I get the expected output (My Answer). I don't know why it says my code returned the answer. How does my answer differ from what my code returned? Why is test data different than input data? Is this test running properly? Would you like to see my code?

Rodion (admin)     2021-11-17 18:05:34
User avatar

Hi Friend!

I'm a bit confused by inputs and outputs you have posted, but looking at your code I have a question:

  • have you got it right, that you should submit regexps instead of the code in any arbitrary programming language?
David Epper Marshall     2021-11-18 18:01:10

The inputs and outputs above are what I see after I click submit. However if I copy the test data, click try again, enter the copied test data as the input and run my script, then my output matches what 'instead of' says. So I'm also super confused about output. I don't know why it says my answer is something that it isn't and I don't know what your input data is

Rodion (admin)     2021-11-18 18:13:38
User avatar

David, Hi! once more: you should not submit any code for this problem.

Submit only regexps, exactly as the problem statement says:

Your Code should contain one or more lines, each consisting of two parts separated with space:
regular expression to be applied to input;
substitution pattern.

Perhaps I should add to problem statement explicit note that nothing other should be present besides these lines :)

David Epper Marshall     2021-11-23 13:37:01

If I try to submit only regex I get an alert "You are to enter both answer and solution source code"

My format is as follows

^pattern$ pat
...more regex...

I've also tried

/^pattern$/ pat
...more regex...
Rodion (admin)     2021-11-23 14:04:59
User avatar

Yep, that's just a flaw of the submission form which I still haven't fixed. Enter anything into "answer", it's ignored by server for this task.

(e.g. you can put the answer to test data you have... they are filled automatically if you click "regexp" button below submission form)

Shall try do do something about this later.

Please login and solve 5 problems to be able to post at forum