As the title suggests, I’m trying to get names that only start with the letter I wish to specify.
Here is the code I’ve been using (in reference to the “First Name” Mockaroo data set):
while this[0,1] != ‘P’
this = [:first_name:]
end
I end up with a syntax error, and it is probably due to the fact that I don’t know how to use regex properly.
I have also tried doing the following, instead of the regex:
this = from_dataset(“Personal”, “First Name”, ‘P’ : first_name[0,1])
^ That didn’t work either, since I’m thinking the ‘P’ : first_name[0,1] bit doesn’t ever change value, and so a new name isn’t chosen, and an infinite loop gets created. Any light on this subject would be quite nice. Thanks in advance!
EDIT: As clarification, what I am trying to accomplish is being able take the current given value (in this case, it would be the result from mockaroo’s “First Name” list) and replace it with another value from that same list. Or, as an alternative, create a subset of the list that follows a restriction (in this case, all names must start with P).