Deck 7: Working With Regular Expressions
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/50
العب
ملء الشاشة (f)
Deck 7: Working With Regular Expressions
1
The \D character is used in a regular expression to look for a match with any numeric character.
False
2
Regular expressions are not limited to data validation. Regular expressions can also be used to search for data within strings and to perform string substitutions.
True
3
Using regular expressions, you can perform detailed analysis of user input to determine if it meets specific criteria.
True
4
In regular expressions, every character inside a pattern is taken literally, with the exception of metacharacters, which are assigned a special meaning.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
5
The \s character is used in a regular expression to set up a match based on white space.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
6
The . character is used in a regular expression to look for a match at the beginning of a line.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
7
The operator is the "equals to" operator in a regular expression.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
8
While you can certainly create scripts based on the assumption that the data received will always be valid, you would do so at your own peril. In most cases, you will want to build data validation logic into your own scripts, rejecting any data that is not the proper format.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
9
A metacharacter is a character that alters the way a pattern match occurs.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
10
You can validate data using regular expressions. However, to truly create powerful validation routines, you should instead rely on conditional logic and methods belonging to Ruby classes.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
11
By default, regular expression matches are case sensitive, although you can override this behavior.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
12
Regular expressions facilitate text substitution operations. However, regular expressions are not able to accommodate differences in case.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
13
The most basic type of regular expression is one that matches up against a specific pattern or a set of characters. This type of pattern can be set up using the {} match operator.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
14
The result of the following example evaluates as true. if "Welcome to New York Harbor, USA." =~ /USA/ then puts "Welcome to America!" end
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
15
The ^ character is used in a regular expression to look for a match at the end of a line.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
16
Using regular expressions, you can pick apart and process the contents of data regardless of its source, including text files and databases.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
17
The =~ operator is the "not equals to" operator in a regular expression.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
18
By default, if a character included in a regular expression pattern matches a character in the source string, true is returned.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
19
The \A character is used in a regular expression to look for a match at the beginning of a string.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
20
You can set up a regular expression pattern to look for possible matches using the | character to separate each possible match.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
21
You can disable case-sensitivity using the optional /c modifier as demonstrated here: /USA/c
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
22
Data processed by computer scripts can come from many different sources, including ____.
A) Databases
B) Files
C) User Input
D) All of the above
A) Databases
B) Files
C) User Input
D) All of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
23
Which of the following regular expression metacharacters looks for a match at the end of a string?
A) \A
B) \Z
C) \w
D) \d
A) \A
B) \Z
C) \w
D) \d
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
24
Which of the following operators should be used in a regular expression to determine equality?
A) !~
B) =
C) +
D) None of the above
A) !~
B) =
C) +
D) None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
25
Using regular expressions you can define patterns that ____.
A) Perform search and replace operations on strings
B) Keep counts of instances of patterns
C) Extract a substring from a larger string
D) All of the above
A) Perform search and replace operations on strings
B) Keep counts of instances of patterns
C) Extract a substring from a larger string
D) All of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
26
Which of the following regular expression metacharacters matches any white space?
A) \W
B) \w
C) \S
D) \s
A) \W
B) \w
C) \S
D) \s
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
27
Which of the following is true about regular expressions?
A) In most cases, regular expression patterns are processed from right to left.
B) Matches occur when patterns are found anywhere within a source string.
C) By default, matches are case insensitive.
D) Every character inside a pattern is taken literally, including metacharacters.
A) In most cases, regular expression patterns are processed from right to left.
B) Matches occur when patterns are found anywhere within a source string.
C) By default, matches are case insensitive.
D) Every character inside a pattern is taken literally, including metacharacters.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
28
The * metacharacter modifier is used to set up pattern matches of zero or more instances of the preceding character.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
29
Which of the following regular expression metacharacters matches any numeric character?
A) \d
B) \D
C) \s
D) \S
A) \d
B) \D
C) \s
D) \S
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
30
The + metacharacter modifier is used to set up pattern matches of one or more instances of the preceding character.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
31
Which of the following regular expression metacharacters looks for a match at the end of a line?
A) .
B) $
C) \W
D) \w
A) .
B) $
C) \W
D) \w
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
32
You can replace all instances of a search pattern using the String class's gsub method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
33
The $ character is used in a regular expression to set up a match with any character.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
34
Which of the following regular expression metacharacters looks for a match at the beginning of a line?
A) .
B) ^
C) $
D) \w
A) .
B) ^
C) $
D) \w
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
35
Which of the following regular expression metacharacters matches any non-alphabetic, non-numeric, or non-underscore character?
A) \S
B) \D
C) \W
D) \Z
A) \S
B) \D
C) \W
D) \Z
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
36
A ____ is a character that alters the way a pattern match occurs.
A) Character class
B) Pattern class
C) Metacharacter
D) Metaword
A) Character class
B) Pattern class
C) Metacharacter
D) Metaword
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
37
Which of the following regular expression metacharacters matches any one character?
A) .
B) ^
C) $
D) \w
A) .
B) ^
C) $
D) \w
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
38
A regular expression is ____.
A) A pattern used to identify matching character data
B) A mechanism that facilitates the collection of input
C) A special type of variable, array, or hash that facilitates pattern matching and string substitution
D) None of the above
A) A pattern used to identify matching character data
B) A mechanism that facilitates the collection of input
C) A special type of variable, array, or hash that facilitates pattern matching and string substitution
D) None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
39
Which of the following statements is true in regard to the following example? if "Welcome the USA!." =~ /USA|America/ then puts "We have a match!" end
A) A pattern search has been set up to search the source string for either the words USA or America. A match occurs if either string is found.
B) A pattern search has been set up to search the source string for both the words USA and America. A match occurs only if both strings are found.
C) A case-insensitive search has been set up that searches the source string for either the words USA or America. A match occurs is either string is found.
D) None of the above.
A) A pattern search has been set up to search the source string for either the words USA or America. A match occurs if either string is found.
B) A pattern search has been set up to search the source string for both the words USA and America. A match occurs only if both strings are found.
C) A case-insensitive search has been set up that searches the source string for either the words USA or America. A match occurs is either string is found.
D) None of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
40
Which of the following regular expression metacharacters matches any non-numeric character?
A) \d
B) \D
C) \s
D) \S
A) \d
B) \D
C) \s
D) \S
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
41
Which of the character classes can be used to match a number between 0 and 9?
A) /[numeric]/
B) /[a - x , 0 - 9]/
C) /[0-9]/
D) All of the above
A) /[numeric]/
B) /[a - x , 0 - 9]/
C) /[0-9]/
D) All of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
42
Character classes are used to search for a range of characters and are defined by placing a list of characters within ____ characters.
A) { }
B) ( )
C) # #
D) [ ]
A) { }
B) ( )
C) # #
D) [ ]
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
43
Which of the character classes can be used to match any lowercase letter?
A) /[abcdefghijklmnopqrstuvwxyz]/
B) /[ABCDEFGHIJKLMNOPQRSTUVWXYZ]/
C) /[A - Z]/
D) /abcdefghijklmnopqrstuvwxyz/
A) /[abcdefghijklmnopqrstuvwxyz]/
B) /[ABCDEFGHIJKLMNOPQRSTUVWXYZ]/
C) /[A - Z]/
D) /abcdefghijklmnopqrstuvwxyz/
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
44
Which of the following String methods can be used to substitute the first instance of a search pattern within a string?
A) sub
B) gsub
C) rsub
D) None of the above
A) sub
B) gsub
C) rsub
D) None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
45
By default, regular expressions perform case sensitive searches. You can override this behavior sing the ____ modifier?
A) a
B) e
C) i
D) o
A) a
B) e
C) i
D) o
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
46
Which of the following String methods can be used to replace all instances of a search pattern within a string?
A) sub
B) gsub
C) rsub
D) None of the above
A) sub
B) gsub
C) rsub
D) None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
47
The ____ metacharacter modifier is used to search a string for zero or more instances of a character.
A) @
B) $
C) ?
D) *
A) @
B) $
C) ?
D) *
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
48
The ____ metacharacter modifier is used to search a string for one or zero instances of a character in the preceding characters.
A) @
B) $
C) ?
D) *
A) @
B) $
C) ?
D) *
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
49
The ____ metacharacter modifier is used to search a string for one or more instances of a character.
A) +
B) =
C) *
D) ?
A) +
B) =
C) *
D) ?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
50
Which of the following character classes can be used to match a complete list of vowels?
A) /aeiou/
B) /uoiea/
C) /a - o/
D) None of the above
A) /aeiou/
B) /uoiea/
C) /a - o/
D) None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck